# # # add_file "guitone/src/util/MemoryTrack.cpp" # content [49e02968529cfa81e6c8a34a49ffeed3808a7739] # # add_file "guitone/src/util/MemoryTrack.h" # content [b61f699af58758857dab4da64484fa695b0df122] # # patch "guitone/guitone.pro" # from [c39e690b16c4e69b49fb537596e6f414eb9e4cf2] # to [eb658145fb39bb84762025c404240a40bc00957e] # # patch "guitone/res/i18n/guitone_de.ts" # from [ba2bb18b98b4f3c34893be1658da9e1ae926b51b] # to [e2f5694e98fea1b89952a733d16b761334a44e97] # # patch "guitone/src/model/Changeset.cpp" # from [4c5c242b954885b24d1c6d566a4850408076d36f] # to [b98179238df6a40561634309a213acfb678b21c7] # # patch "guitone/src/model/ChangesetModel.cpp" # from [4d2f708a0de95674dec1b8782b8c09ba6b579496] # to [87311b8fa12c6a44642b068596381128d23a6786] # # patch "guitone/src/model/ChangesetModel.h" # from [b86d41dac3d68175c8564c926a922528eaab8823] # to [64fd0a3ab67ffc973863a60f8c5f76b02b8e1365] # # patch "guitone/src/view/MainWindow.cpp" # from [59056dbbe09d50ff14081d1e7158cae80178da75] # to [2c9f93a0ece1daca16d26c942171d44c0f7dce3c] # ============================================================ --- guitone/src/util/MemoryTrack.cpp 49e02968529cfa81e6c8a34a49ffeed3808a7739 +++ guitone/src/util/MemoryTrack.cpp 49e02968529cfa81e6c8a34a49ffeed3808a7739 @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jean-Louis Fuchs * + * address@hidden * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +struct AllocInfo +{ + void *ptr; + unsigned int size; + int line; + QString file; +}; + +QMap trackMap; + +void * trackedNew(unsigned int size, const char *file, int line) +{ + AllocInfo info; + void *ptr = (void *)malloc(size); + info.ptr = ptr; + info.size = size; + info.file = QString(file); + info.line = line; + trackMap[ptr] = info; + return ptr; +} + +void trackedDelete(void *ptr) +{ + free(ptr); + trackMap.remove(ptr); +} + +void writeUnfreed() +{ + #ifdef _DEBUG + quint32 totalSize = 0; + if(trackMap.count() != 0) + { + qDebug() << "Unfreed memory report"; + qDebug() << "---------------------"; + + foreach(AllocInfo info, trackMap) + { + totalSize += info.size; + qDebug() << info.size << "bytes in file" << info.file << "line" << info.line; + } + qDebug() << "Total size of unfreed memory: " << totalSize; + qDebug() << "---------------------"; + } + #endif +} ============================================================ --- guitone/src/util/MemoryTrack.h b61f699af58758857dab4da64484fa695b0df122 +++ guitone/src/util/MemoryTrack.h b61f699af58758857dab4da64484fa695b0df122 @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jean-Louis Fuchs * + * address@hidden * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef MEMORYTRACK_H +#define MEMORYTRACK_H + +#ifdef _DEBUG +void * trackedNew(unsigned int size, const char *file, int line); +void trackedDelete(void *p); +void writeUnfreed(); + +inline void * operator new(unsigned int size, const char *file, int line) +{ + return trackedNew(size, file, line); +} + +inline void operator delete(void *p, const char *file, int line) +{ + trackedDelete(p); +} + +inline void operator delete(void *p) +{ + trackedDelete(p); +} + +inline void * operator new[](unsigned int size, const char *file, int line) +{ + return trackedNew(size, file, line); +} + +inline void operator delete[](void *p, const char *file, int line) +{ + trackedDelete(p); +} + +inline void operator delete[](void *p) +{ + trackedDelete(p); +} +#endif + +#ifdef _DEBUG +#define DEBUG_NEW new(__FILE__, __LINE__) +#else +#define DEBUG_NEW new +#endif +#define new DEBUG_NEW + +#endif ============================================================ --- guitone/guitone.pro c39e690b16c4e69b49fb537596e6f414eb9e4cf2 +++ guitone/guitone.pro eb658145fb39bb84762025c404240a40bc00957e @@ -57,7 +57,8 @@ HEADERS += src/view/MainWindow.h \ src/util/Platform.h \ src/util/TreeBuilder.h \ src/util/DebugLog.h \ - src/util/StdioParser.h + src/util/StdioParser.h \ + src/util/MemoryTrack.h SOURCES += src/view/MainWindow.cpp \ src/view/TreeView.cpp \ src/view/Splitter.cpp \ @@ -104,6 +105,7 @@ SOURCES += src/view/MainWindow.cpp \ src/util/TreeBuilder.cpp \ src/util/DebugLog.cpp \ src/util/StdioParser.cpp \ + src/util/MemoryTrack.cpp \ src/main.cpp FORMS += res/forms/switch_workspace.ui \ ============================================================ --- guitone/res/i18n/guitone_de.ts ba2bb18b98b4f3c34893be1658da9e1ae926b51b +++ guitone/res/i18n/guitone_de.ts e2f5694e98fea1b89952a733d16b761334a44e97 @@ -136,22 +136,22 @@ ChangesetModel - + Revision ID Revisions-ID - + Date Datum - + Author Autor - + Changelog ============================================================ --- guitone/src/model/Changeset.cpp 4c5c242b954885b24d1c6d566a4850408076d36f +++ guitone/src/model/Changeset.cpp b98179238df6a40561634309a213acfb678b21c7 @@ -46,9 +46,9 @@ QString Changeset::getChangelogFlat() QString Changeset::getChangelogFlat() { QString cl = changelog; - cl.replace("\n", ""); - cl.replace("\r", ""); - cl.replace("\t", ""); + cl.replace('\n', ' '); + cl.replace('\r', ' '); + cl.replace('\t', ' '); return cl; } ============================================================ --- guitone/src/model/ChangesetModel.cpp 4d2f708a0de95674dec1b8782b8c09ba6b579496 +++ guitone/src/model/ChangesetModel.cpp 87311b8fa12c6a44642b068596381128d23a6786 @@ -27,7 +27,11 @@ ChangesetModel::ChangesetModel(QObject * currentBranch = ""; } -ChangesetModel::~ChangesetModel() {} +ChangesetModel::~ChangesetModel() +{ + foreach(Changeset *it, changesetMap) + delete it; +} void ChangesetModel::receiveRevisions(bool all) { ============================================================ --- guitone/src/model/ChangesetModel.h b86d41dac3d68175c8564c926a922528eaab8823 +++ guitone/src/model/ChangesetModel.h 64fd0a3ab67ffc973863a60f8c5f76b02b8e1365 @@ -24,6 +24,7 @@ #include "Changeset.h" #include "GetBranchLog.h" #include "Certs.h" +#include "..\util\MemoryTrack.h" #include #include ============================================================ --- guitone/src/view/MainWindow.cpp 59056dbbe09d50ff14081d1e7158cae80178da75 +++ guitone/src/view/MainWindow.cpp 2c9f93a0ece1daca16d26c942171d44c0f7dce3c @@ -33,6 +33,7 @@ #include "About.h" #include "Settings.h" #include "DatabaseView.h" +#include "MemoryTrack.h" #include #include @@ -177,6 +178,7 @@ void MainWindow::quit() { delete this; Settings::sync(); + writeUnfreed(); } void MainWindow::criticalMtnError(const QString & msg)