# # # patch "guitone/src/main.cpp" # from [a3a0d924e82435da9d29483c1a2d6b8c8c568c14] # to [579911ac98f8e279d5325026e29dbd2f76793fff] # # patch "guitone/src/model/Ancestors.cpp" # from [81d57af07ba418801dbf929278e71d5a8bf4262c] # to [39e442993ecedbce40ab73a6f1ac37b4019aa127] # # patch "guitone/src/model/Attributes.cpp" # from [0c2d183d2e70a6b146b66477ec80e90fdfbd8674] # to [5a06562cb354ab61e2580ec1207174bddf698283] # # patch "guitone/src/model/Branches.cpp" # from [d01c1d28d8f4aa2b0b509170703816b26bf06bba] # to [145442c130649fddb7681cdd4397fc88b4c551a7] # # patch "guitone/src/model/Certs.cpp" # from [834e23dbe80ac792f2f50550e770cf922f88c208] # to [0fd05611a6c091b46c08740bdf2a059b64dd97f9] # # patch "guitone/src/model/ChangesetModel.cpp" # from [87311b8fa12c6a44642b068596381128d23a6786] # to [4b7b0e4f84142c4183a96a7b784c6e0ebcf839e7] # # patch "guitone/src/model/ContentDiff.cpp" # from [4cb868e9bf2d592db68a2988e25100cfb961a40e] # to [6df42733cdb1a0565da7ef036ea1ad3d096befd3] # # patch "guitone/src/model/GetBranchLog.cpp" # from [73ca4a607d8a2a2c4cb9190d9ec12411a794906a] # to [20aaa38f0accb2c4b6577ba2f4fb7b1465abb443] # # patch "guitone/src/model/GetFile.cpp" # from [847161c06efe93bed700432f94b5e358b8d62ebf] # to [ccc266ee947217de7eafa0f5c7923af0b75b77f1] # # patch "guitone/src/model/Inventory.cpp" # from [27456152285ea14d09b7fe5efb57882a12d33e31] # to [17b32add147761b4e73e21e6eba2815c03f4e07b] # # patch "guitone/src/model/Keys.cpp" # from [9b85862fecee28770b89e2d878c3d8905b10ae9a] # to [c66537e65be48f2b08639fd8feac83b479dc74c1] # # patch "guitone/src/model/Manifest.cpp" # from [7ebb819d474efd7958d008aa479bbcf940b6d1b3] # to [4e59fa6e31c5fe70c3e3d0bad5f02fafa1c5ced8] # # patch "guitone/src/model/Select.cpp" # from [677dba9de437975a3ff1c1cb3de567fececa6da0] # to [76e34dd9646c8b47d71ac0a9874b89c46c78f30a] # # patch "guitone/src/model/Tags.cpp" # from [64b8da12caf7648865d97ba4d401acf882f6bc10] # to [1020ef054d35a2f73178d5a0e8fcde9d8c23c6f9] # # patch "guitone/src/model/Toposort.cpp" # from [2433a2796f929d4fe2d46cc72a4d83d92b9d0eca] # to [544f0de836eb532c6d35372b87c2667f6585d741] # # patch "guitone/src/monotone/Monotone.cpp" # from [67695c80ab3235132e5ef09938b17ff9f9c41dc1] # to [656b3d08e1e7201707a4060d44d0af3763d7796f] # # patch "guitone/src/util/DebugLog.cpp" # from [cbb560ee73240717fec46f546da2fa0952052d4e] # to [8e2edf66cdb61664357366a0bd3b630e049bf110] # # patch "guitone/src/util/DiffParser.cpp" # from [9ae72b02eea243a234cc236b83ff0502cfadaa46] # to [657af31d18e2da6d8decc87593c864ee18f83ded] # # patch "guitone/src/util/MemoryTrack.cpp" # from [4dc980c9ee6e3286cf27a821d865bded7c3b1ad9] # to [c1ccf0535cf69ec811d4680d934aee9c90f50f32] # # patch "guitone/src/util/MemoryTrack.h" # from [2167e1c18ad9245bcb5610a685c1458c37c76de5] # to [aec89269cb409e5414e7b1e92bc906cb45b3b678] # # patch "guitone/src/util/Settings.cpp" # from [23ac3899da46d0555b39a375b966dc69322cdb20] # to [f080174d7e869a08be44b56f520233c70d89b628] # # patch "guitone/src/util/TreeBuilder.cpp" # from [c4d4da986645b777ab83d135c3673dc042993d58] # to [02428e13772ec4b16a2f7e827a81ed7069704df8] # # patch "guitone/src/view/InventoryView.cpp" # from [dc7b20564cdc3bd26e1dd4f498729f15198509f1] # to [992c0bc303e267e1fa71d63d1b7325157852ee39] # # patch "guitone/src/view/MainWindow.cpp" # from [928c4689e62b90d92c0f5ee990b80133f3c77d71] # to [5e74f5b51c0d5ceee5eecd65171e699abb09f982] # # patch "guitone/src/view/dialogs/DatabaseView.cpp" # from [46f48c4b9060cb37cb8a28f6b652a599e131ffa9] # to [409adc79ca2856f04777b22233321f3267b495da] # # patch "guitone/src/view/dialogs/FileDiff.cpp" # from [d50964c71c13049a79af8271ed4a8a0c98112d73] # to [d698dbe33ae62fec978cf9bef97a19e799b94374] # # patch "guitone/src/view/dialogs/KeyManagement.cpp" # from [a57f544194f11df59d66b4dd2447c24ff899ae9d] # to [16a63b656dce70739afccdd507bb68c400cd029d] # # patch "guitone/src/view/dialogs/RevisionDiff.cpp" # from [63eb939175650c01c82ce8e7252f88f69c84fc80] # to [9795c6fabe86a1ac4f71248c038c3516c81c95f5] # # patch "guitone/src/view/dialogs/RevisionManifest.cpp" # from [87c413184dee30b528d784b2f67d448d45f10ff7] # to [f68113f5bc124de858b097d136e59c162f7d6485] # # patch "guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp" # from [4577dc3fa56e55ccfe2cbcfe3e31a413f9148f80] # to [4ff7c85d7e1154607ce8ec0ba7ed263acc93158c] # ============================================================ --- guitone/src/main.cpp a3a0d924e82435da9d29483c1a2d6b8c8c568c14 +++ guitone/src/main.cpp 579911ac98f8e279d5325026e29dbd2f76793fff @@ -65,7 +65,7 @@ int main(int argc, char** argv) } // create and show the main window - MainWindow *mainWnd = new MainWindow(); + MainWindow *mainWnd = mtnew(MainWindow, ); // try initialize the main window if (!mainWnd->init()) ============================================================ --- guitone/src/model/Ancestors.cpp 81d57af07ba418801dbf929278e71d5a8bf4262c +++ guitone/src/model/Ancestors.cpp 39e442993ecedbce40ab73a6f1ac37b4019aa127 @@ -27,8 +27,8 @@ Ancestors::Ancestors(QObject *parent) Ancestors::Ancestors(QObject *parent) : QAbstractItemModel(parent) { - selRevisions = new RevisionList(); - mtnDelegate = new MonotoneDelegate(this); + selRevisions = mtnew(RevisionList, ); + mtnDelegate = mtnew(MonotoneDelegate, this); } Ancestors::~Ancestors() @@ -36,10 +36,10 @@ Ancestors::~Ancestors() if (selRevisions) { selRevisions->clear(); - delete selRevisions; + mtdelete(selRevisions); } - delete mtnDelegate; + mtdelete(mtnDelegate); } bool Ancestors::readAncestors(const QStringList & parents) @@ -73,7 +73,7 @@ void Ancestors::parseOutput() if (selRevisions > 0) { selRevisions->clear(); - delete selRevisions; + mtdelete(selRevisions); selRevisions = new RevisionList( AutomateCommand::data.split('\n', QString::SkipEmptyParts) ); ============================================================ --- guitone/src/model/Attributes.cpp 0c2d183d2e70a6b146b66477ec80e90fdfbd8674 +++ guitone/src/model/Attributes.cpp 5a06562cb354ab61e2580ec1207174bddf698283 @@ -28,15 +28,15 @@ Attributes::Attributes(QObject *parent) Attributes::Attributes(QObject *parent) : QAbstractItemModel(parent) { - attributes = new AttributeList(); - mtnDelegate = new MonotoneDelegate(this); + attributes = mtnew(AttributeList, ); + mtnDelegate = mtnew(MonotoneDelegate, this); } Attributes::~Attributes() { attributes->clear(); - delete attributes; - delete mtnDelegate; + mtdelete(attributes); + mtdelete(mtnDelegate); } bool Attributes::readAttributes(const QModelIndex & index) ============================================================ --- guitone/src/model/Branches.cpp d01c1d28d8f4aa2b0b509170703816b26bf06bba +++ guitone/src/model/Branches.cpp 145442c130649fddb7681cdd4397fc88b4c551a7 @@ -25,14 +25,14 @@ Branches::Branches(bool tree, QObject *p { builder = 0; Branches::tree = tree; - mtnDelegate = new MonotoneDelegate(this); + mtnDelegate = mtnew(MonotoneDelegate, this); } Branches::~Branches() { if(builder) - delete builder; - delete mtnDelegate; + mtdelete(builder); + mtdelete(mtnDelegate); } bool Branches::readBranches() @@ -48,14 +48,14 @@ void Branches::parseOutput() void Branches::parseOutput() { - branches.setHorizontalHeaderItem(0, new QStandardItem(tr("Branches"))); + branches.setHorizontalHeaderItem(0, mtnew(QStandardItem, tr("Branches"))); if(tree) { - QStandardItem *root = new QStandardItem("*"); + QStandardItem *root = mtnew(QStandardItem, "*"); root->setData("*", Qt::ToolTipRole); branches.appendRow(root); - builder = new TreeBuilder(root, this); + builder = mtnew(TreeBuilder, root, this); builder->addList(AutomateCommand::data); } else @@ -66,7 +66,7 @@ void Branches::parseOutput() while(iterator.hasNext()) { QString it = iterator.next(); - QStandardItem *item = new QStandardItem(it); + QStandardItem *item = mtnew(QStandardItem, it); item->setData(it, Qt::ToolTipRole); branches.appendRow(item); } ============================================================ --- guitone/src/model/Certs.cpp 834e23dbe80ac792f2f50550e770cf922f88c208 +++ guitone/src/model/Certs.cpp 0fd05611a6c091b46c08740bdf2a059b64dd97f9 @@ -24,15 +24,15 @@ Certs::Certs(QObject *parent) : QAbstrac Certs::Certs(QObject *parent) : QAbstractItemModel(parent) { - certs = new CertList(); - mtnDelegate = new MonotoneDelegate(this); + certs = mtnew(CertList, ); + mtnDelegate = mtnew(MonotoneDelegate, this); } Certs::~Certs() { certs->clear(); - delete certs; - delete mtnDelegate; + mtdelete(certs); + mtdelete(mtnDelegate); } bool Certs::readCerts(const QString & rev) ============================================================ --- guitone/src/model/ChangesetModel.cpp 87311b8fa12c6a44642b068596381128d23a6786 +++ guitone/src/model/ChangesetModel.cpp 4b7b0e4f84142c4183a96a7b784c6e0ebcf839e7 @@ -30,7 +30,7 @@ ChangesetModel::~ChangesetModel() ChangesetModel::~ChangesetModel() { foreach(Changeset *it, changesetMap) - delete it; + mtdelete(it); } void ChangesetModel::receiveRevisions(bool all) @@ -44,7 +44,7 @@ void ChangesetModel::receiveRevisions(bo if(changesetMap[revision] == NULL) { - ChangesetCerts *certs = new ChangesetCerts(currentBranch, revision, i, this); + ChangesetCerts *certs = mtnew(ChangesetCerts, currentBranch, revision, i, this); certs->readCerts(revision); c++; } @@ -59,7 +59,7 @@ void ChangesetModel::setBranch(QString b if(branchInfo->revisions.count() == 0) { branchInfo->certsRead = 0; - GetBranchLog *glog = new GetBranchLog(branch, this); + mtnew(GetBranchLog, branch, this); } else reset(); @@ -73,7 +73,7 @@ void ChangesetModel::branchLogRead(GetBr { receiveRevisions(false); } - delete glog; + mtdelete(glog); } void ChangesetModel::changesetCertReady(ChangesetCerts *cert) @@ -104,13 +104,13 @@ void ChangesetModel::changesetCertReady( continue; } } - Changeset *set = new Changeset(cert->getRevision(), date, author, changelog); + Changeset *set = mtnew(Changeset, cert->getRevision(), date, author, changelog); changesetMap[cert->getRevision()] = set; int idx = cert->getIndex(); branchMap[currentBranch].certsRead = idx; beginInsertRows(QModelIndex(), idx, idx); endInsertRows(); - delete cert; + mtdelete(cert); } int ChangesetModel::columnCount(const QModelIndex &parent) const ============================================================ --- guitone/src/model/ContentDiff.cpp 4cb868e9bf2d592db68a2988e25100cfb961a40e +++ guitone/src/model/ContentDiff.cpp 6df42733cdb1a0565da7ef036ea1ad3d096befd3 @@ -28,15 +28,15 @@ ContentDiff::ContentDiff(QObject *parent : QAbstractItemModel(parent) { diffParser = 0; - mtnDelegate = new MonotoneDelegate(this); + mtnDelegate = mtnew(MonotoneDelegate, this); } ContentDiff::~ContentDiff() { - if (diffParser) delete diffParser; + if (diffParser) mtdelete(diffParser); foreach(ListLine *it, lines) - delete it; - delete mtnDelegate; + mtdelete(it); + mtdelete(mtnDelegate); } bool ContentDiff::readDiff(QString fileName) @@ -92,7 +92,7 @@ void ContentDiff::parseOutput() void ContentDiff::parseOutput() { - diffParser = new DiffParser(AutomateCommand::data); + diffParser = mtnew(DiffParser, AutomateCommand::data); // flatten the data for the current view FileDiffs fileDiffs = diffParser->getAllDiffs(); @@ -101,7 +101,7 @@ void ContentDiff::parseOutput() while (i.hasNext()) { i.next(); - ListLine * fileLine = new ListLine(ListLine::FileLine); + ListLine * fileLine = mtnew(ListLine, ListLine::FileLine); lines.append(fileLine); Diff * diff = (Diff*)i.value(); @@ -121,7 +121,7 @@ void ContentDiff::parseOutput() for (int m=0, n=hunk->lines.size(); mlines.at(m); - ListLine * hunkLine = new ListLine(ListLine::HunkLine); + ListLine * hunkLine = mtnew(ListLine, ListLine::HunkLine); fileLine->addChild(hunkLine); if (line->state == DiffLine::Unchanged) @@ -141,7 +141,7 @@ void ContentDiff::parseOutput() if (j < k-1) { - ListLine * sep = new ListLine(ListLine::HunkSep); + ListLine * sep = mtnew(ListLine, ListLine::HunkSep); fileLine->addChild(sep); } } ============================================================ --- guitone/src/model/GetBranchLog.cpp 73ca4a607d8a2a2c4cb9190d9ec12411a794906a +++ guitone/src/model/GetBranchLog.cpp 20aaa38f0accb2c4b6577ba2f4fb7b1465abb443 @@ -23,9 +23,9 @@ GetBranchLog::GetBranchLog(QString branc GetBranchLog::GetBranchLog(QString branch, QObject *parent) : QObject(parent) { this->branch = branch; - selectModel = new Select(this); - revSortModel = new Toposort(this); - ancestorModel = new Ancestors(this); + selectModel = mtnew(Select, this); + revSortModel = mtnew(Toposort, this); + ancestorModel = mtnew(Ancestors, this); revSortModel->setSourceModel(ancestorModel); connect(selectModel, SIGNAL(selectionRead()), this, SLOT(selectionReady())); @@ -38,9 +38,9 @@ GetBranchLog::~GetBranchLog() GetBranchLog::~GetBranchLog() { - delete selectModel; - delete revSortModel; - delete ancestorModel; + mtdelete(selectModel); + mtdelete(revSortModel); + mtdelete(ancestorModel); } QString GetBranchLog::getBranch() ============================================================ --- guitone/src/model/GetFile.cpp 847161c06efe93bed700432f94b5e358b8d62ebf +++ guitone/src/model/GetFile.cpp ccc266ee947217de7eafa0f5c7923af0b75b77f1 @@ -25,12 +25,12 @@ GetFile::GetFile(QObject *parent) : QAbs GetFile::GetFile(QObject *parent) : QAbstractItemModel(parent) { - mtnDelegate = new MonotoneDelegate(this); + mtnDelegate = mtnew(MonotoneDelegate, this); } GetFile::~GetFile() { - delete mtnDelegate; + mtdelete(mtnDelegate); } bool GetFile::readFileByName(QString fileName) @@ -96,7 +96,7 @@ void GetFile::parseOutput() for (int i=0, s=lines.size() - 1; icontent, ContentLine::Added) + mtnew(ContentLine, line->content, ContentLine::Added) ); lineOffset++; lineStart++; ============================================================ --- guitone/src/model/Inventory.cpp 27456152285ea14d09b7fe5efb57882a12d33e31 +++ guitone/src/model/Inventory.cpp 17b32add147761b4e73e21e6eba2815c03f4e07b @@ -29,23 +29,23 @@ Inventory::Inventory(QObject *parent) : { // create a dummy item since the view needs at least one item // in the model, otherwise the app crashes - rootItem = new InventoryItem(); + rootItem = mtnew(InventoryItem, ); - iconProvider = new IconProvider(); - regex = new QRegExp("^(R|D|[ ])(R|A|[ ])(M|P|U|I|[ ])\\s(\\d+)\\s(\\d+)\\s(.+)$"); + iconProvider = mtnew(IconProvider, ); + regex = mtnew(QRegExp, "^(R|D|[ ])(R|A|[ ])(M|P|U|I|[ ])\\s(\\d+)\\s(\\d+)\\s(.+)$"); regex->setMinimal(true); - mtnDelegate = new MonotoneDelegate(this); + mtnDelegate = mtnew(MonotoneDelegate, this); modelPresent = false; } Inventory::~Inventory() { - delete rootItem; - delete iconProvider; - delete regex; - delete mtnDelegate; + mtdelete(rootItem); + mtdelete(iconProvider); + mtdelete(regex); + mtdelete(mtnDelegate); } bool Inventory::readInventory() @@ -89,7 +89,7 @@ void Inventory::parseOutput() } // this item is given a parent explicitely later on - item = new InventoryItem(NULL, path, status, isDirectory); + item = mtnew(InventoryItem, NULL, path, status, isDirectory); if (from_id > 0) { @@ -116,7 +116,7 @@ void Inventory::parseOutput() // FIXME: we shouldn't really add a workspace root item here, but // mtn automate inventory currently doesn't print the root workspace dir - InventoryItem* workspace = new InventoryItem(rootItem, ".", 0, true, true); + InventoryItem* workspace = mtnew(InventoryItem, rootItem, ".", 0, true, true); Monotone * mtn = Monotone::singleton(); workspace->setLabel(mtn->getNormalizedWorkspacePath()); rootItem->appendChild(workspace); ============================================================ --- guitone/src/model/Keys.cpp 9b85862fecee28770b89e2d878c3d8905b10ae9a +++ guitone/src/model/Keys.cpp c66537e65be48f2b08639fd8feac83b479dc74c1 @@ -27,12 +27,12 @@ Keys::Keys(QObject *parent) : QAbstractI Keys::Keys(QObject *parent) : QAbstractItemModel(parent) { - mtnDelegate = new MonotoneDelegate(this); + mtnDelegate = mtnew(MonotoneDelegate, this); } Keys::~Keys() { - delete mtnDelegate; + mtdelete(mtnDelegate); } bool Keys::readKeys() @@ -56,7 +56,7 @@ void Keys::parseOutput() { Stanza stanza = list.at(i); - key = new Key(); + key = mtnew(Key, ); bool isItem = false; for (int j=0, size2 = stanza.size(); j < size2; j++) ============================================================ --- guitone/src/model/Manifest.cpp 7ebb819d474efd7958d008aa479bbcf940b6d1b3 +++ guitone/src/model/Manifest.cpp 4e59fa6e31c5fe70c3e3d0bad5f02fafa1c5ced8 @@ -23,14 +23,14 @@ Manifest::Manifest(QObject *parent) : QA Manifest::Manifest(QObject *parent) : QAbstractItemModel(parent) { - mtnDelegate = new MonotoneDelegate(this); + mtnDelegate = mtnew(MonotoneDelegate, this); root = NULL; } Manifest::~Manifest() { - delete root; - delete mtnDelegate; + mtdelete(root); + mtdelete(mtnDelegate); } bool Manifest::readManifest(const QString & rev) @@ -64,7 +64,7 @@ void Manifest::parseOutput() if (j == 0) { if (entry.sym == "format_version") break; - mEntry = new ManifestEntry(); + mEntry = mtnew(ManifestEntry, ); } Q_ASSERT(mEntry); ============================================================ --- guitone/src/model/Select.cpp 677dba9de437975a3ff1c1cb3de567fececa6da0 +++ guitone/src/model/Select.cpp 76e34dd9646c8b47d71ac0a9874b89c46c78f30a @@ -27,8 +27,8 @@ Select::Select(QObject *parent) Select::Select(QObject *parent) : QAbstractItemModel(parent) { - selRevisions = new RevisionList(); - mtnDelegate = new MonotoneDelegate(this); + selRevisions = mtnew(RevisionList, ); + mtnDelegate = mtnew(MonotoneDelegate, this); } Select::~Select() @@ -36,10 +36,10 @@ Select::~Select() if (selRevisions) { selRevisions->clear(); - delete selRevisions; + mtdelete(selRevisions); } - delete mtnDelegate; + mtdelete(mtnDelegate); } bool Select::readSelection(const QString & selector) @@ -73,7 +73,7 @@ void Select::parseOutput() if (selRevisions > 0) { selRevisions->clear(); - delete selRevisions; + mtdelete(selRevisions); selRevisions = new RevisionList( AutomateCommand::data.split('\n', QString::SkipEmptyParts) ); ============================================================ --- guitone/src/model/Tags.cpp 64b8da12caf7648865d97ba4d401acf882f6bc10 +++ guitone/src/model/Tags.cpp 1020ef054d35a2f73178d5a0e8fcde9d8c23c6f9 @@ -24,15 +24,15 @@ Tags::Tags(QObject *parent) : QAbstractI Tags::Tags(QObject *parent) : QAbstractItemModel(parent) { - tags = new TagList(); - mtnDelegate = new MonotoneDelegate(this); + tags = mtnew(TagList, ); + mtnDelegate = mtnew(MonotoneDelegate, this); } Tags::~Tags() { tags->clear(); - delete tags; - delete mtnDelegate; + mtdelete(tags); + mtdelete(mtnDelegate); } bool Tags::readTags(const QString & branch) ============================================================ --- guitone/src/model/Toposort.cpp 2433a2796f929d4fe2d46cc72a4d83d92b9d0eca +++ guitone/src/model/Toposort.cpp 544f0de836eb532c6d35372b87c2667f6585d741 @@ -27,8 +27,8 @@ Toposort::Toposort(QObject *parent) : QS Toposort::Toposort(QObject *parent) : QSortFilterProxyModel(parent), sortColumn(0), sortOrder(Qt::AscendingOrder) { - ordRevisions = new RevisionMap(); - mtnDelegate = new MonotoneDelegate(this); + ordRevisions = mtnew(RevisionMap, ); + mtnDelegate = mtnew(MonotoneDelegate, this); showRows = false; } @@ -37,9 +37,9 @@ Toposort::~Toposort() if (ordRevisions) { ordRevisions->clear(); - delete ordRevisions; + mtdelete(ordRevisions); } - delete mtnDelegate; + mtdelete(mtnDelegate); } void Toposort::setSourceModel(QAbstractItemModel * source) ============================================================ --- guitone/src/monotone/Monotone.cpp 67695c80ab3235132e5ef09938b17ff9f9c41dc1 +++ guitone/src/monotone/Monotone.cpp 656b3d08e1e7201707a4060d44d0af3763d7796f @@ -120,7 +120,7 @@ Monotone* Monotone::singleton(QObject * Monotone* Monotone::singleton(QObject * parent) { // create a new instance if there is no instance - if (instance == 0) { instance = new Monotone(parent); } + if (instance == 0) { instance = mtnew(Monotone, parent); } return instance; } @@ -201,7 +201,7 @@ void Monotone::shutdownCurrentProcess() this, SLOT(processFinished(int, QProcess::ExitStatus)) ); - delete process; + mtdelete(process); } } @@ -212,7 +212,7 @@ void Monotone::setupNewProcess() shutdownCurrentProcess(); isCleanExit = false; - process = new QProcess(this); + process = mtnew(QProcess, this); // monitor if the process is exited unexpectedly connect( ============================================================ --- guitone/src/util/DebugLog.cpp cbb560ee73240717fec46f546da2fa0952052d4e +++ guitone/src/util/DebugLog.cpp 8e2edf66cdb61664357366a0bd3b630e049bf110 @@ -36,7 +36,7 @@ DebugLog* DebugLog::singleton() { if (!instance) { - instance = new DebugLog(); + instance = mtnew(DebugLog, ); } return instance; } ============================================================ --- guitone/src/util/DiffParser.cpp 9ae72b02eea243a234cc236b83ff0502cfadaa46 +++ guitone/src/util/DiffParser.cpp 657af31d18e2da6d8decc87593c864ee18f83ded @@ -31,7 +31,7 @@ DiffParser::~DiffParser() DiffParser::~DiffParser() { foreach(Diff *it, fileDiffs.values()) - delete it; + mtdelete(it); } void DiffParser::parse(const QString & input) @@ -67,7 +67,7 @@ void DiffParser::parse(const QString & i QString nextGroup(lines.at(++i)); // create a new diff - curDiff = new Diff(); + curDiff = mtnew(Diff, ); // check if this is a binary QRegExp rx = QRegExp("^#\\s(.+)\\sis binary"); @@ -106,7 +106,7 @@ void DiffParser::parse(const QString & i Q_ASSERT(list.size() >= 2); // create a new Hunk - curHunk = new DiffHunk(); + curHunk = mtnew(DiffHunk, ); curDiff->hunks.push_back(curHunk); // extract line numbers and positions @@ -127,7 +127,7 @@ void DiffParser::parse(const QString & i Q_ASSERT(curHunk); - DiffLine * diffLine = new DiffLine(); + DiffLine * diffLine = mtnew(DiffLine, ); curHunk->lines.push_back(diffLine); diffLine->content = line.mid(1); ============================================================ --- guitone/src/util/MemoryTrack.cpp 4dc980c9ee6e3286cf27a821d865bded7c3b1ad9 +++ guitone/src/util/MemoryTrack.cpp c1ccf0535cf69ec811d4680d934aee9c90f50f32 @@ -1,42 +1,43 @@ /*************************************************************************** - * 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. * - ***************************************************************************/ +* 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 +#include "MemoryTrack.h" struct AllocInfo { void *ptr; - unsigned int size; + size_t size; int line; QString file; }; QMap trackMap; -void *mtTrackedNew(std::size_t size, const char *file, int line) throw (std::bad_alloc) +void *mtTrackNew(size_t size, void *ptr, const char *file, int line) throw (std::bad_alloc) { AllocInfo info; - void *ptr = ::operator new(size); info.ptr = ptr; + info.size = 0; info.size = size; info.file = QString(file); info.line = line; @@ -44,21 +45,20 @@ void *mtTrackedNew(std::size_t size, con return ptr; } -void mtTrackedDelete(void *ptr) throw () +void mtTrackDelete(void *ptr) throw () { - ::operator delete(ptr); trackMap.remove(ptr); } void writeUnfreed() { - #ifdef _DEBUG +#ifdef _DEBUG quint32 totalSize = 0; if(trackMap.count() != 0) { qDebug() << "Unfreed memory report"; qDebug() << "---------------------"; - + foreach(AllocInfo info, trackMap) { totalSize += info.size; @@ -67,5 +67,5 @@ void writeUnfreed() qDebug() << "Total size of unfreed memory: " << totalSize; qDebug() << "---------------------"; } - #endif +#endif } ============================================================ --- guitone/src/util/MemoryTrack.h 2167e1c18ad9245bcb5610a685c1458c37c76de5 +++ guitone/src/util/MemoryTrack.h aec89269cb409e5414e7b1e92bc906cb45b3b678 @@ -1,22 +1,22 @@ /*************************************************************************** - * 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. * - ***************************************************************************/ +* 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 @@ -24,18 +24,18 @@ #ifdef _DEBUG #include -void *mtTrackedNew(std::size_t size, const char *file, int line) throw (std::bad_alloc); -void mtTrackedDelete(void *ptr); +void *mtTrackNew(size_t size, void *ptr, const char *file, int line) throw (std::bad_alloc); +void mtTrackDelete(void *ptr) throw (); void writeUnfreed(); -#define mtnew(type) mtTrackedNew(sizeof(type)) -#define mtdelete(ptr) mtTrackedDelete(ptr) +#define mtnew(type, ...) (type*) mtTrackNew(sizeof(type), (void*) new type(__VA_ARGS__), __FILE__, __LINE__) +#define mtdelete(ptr) { delete ptr; mtTrackDelete(ptr); } #else #define writeUnfreed void -#define mtnew(type) ::operator new(sizeof(type)) -#define mtdelete(ptr) ::operator delete(ptr) +#define mtnew(type, ...) new type(__VA_ARGS__) +#define mtdelete(ptr) delete ptr #endif #endif ============================================================ --- guitone/src/util/Settings.cpp 23ac3899da46d0555b39a375b966dc69322cdb20 +++ guitone/src/util/Settings.cpp f080174d7e869a08be44b56f520233c70d89b628 @@ -26,7 +26,7 @@ Settings* Settings::singleton() { if (!instance) { - instance = new Settings(); + instance = mtnew(Settings, ); } return instance; } ============================================================ --- guitone/src/util/TreeBuilder.cpp c4d4da986645b777ab83d135c3673dc042993d58 +++ guitone/src/util/TreeBuilder.cpp 02428e13772ec4b16a2f7e827a81ed7069704df8 @@ -86,7 +86,7 @@ QStandardItem* TreeBuilder::add(const QS parent->removeRow(index); // Create a new parent to replace the old child - QStandardItem *newparent = new QStandardItem(); + QStandardItem *newparent = mtnew(QStandardItem, ); newparent->setData(branch.left(pos)); // Add the new parent to the parent @@ -110,7 +110,7 @@ QStandardItem* TreeBuilder::add(const QS } } - QStandardItem *it = new QStandardItem(); + QStandardItem *it = mtnew(QStandardItem, ); it->setData(branch); parent->appendRow(it); addData(it); ============================================================ --- guitone/src/view/InventoryView.cpp dc7b20564cdc3bd26e1dd4f498729f15198509f1 +++ guitone/src/view/InventoryView.cpp 992c0bc303e267e1fa71d63d1b7325157852ee39 @@ -216,47 +216,47 @@ void InventoryView::createAndConnectCont void InventoryView::createAndConnectContextActions(void) { - actChdir = new QAction(tr("&Go into"), this); + actChdir = mtnew(QAction, tr("&Go into"), this); actChdir->setStatusTip(tr("Go into the directory")); connect(actChdir, SIGNAL(triggered()), this, SLOT(slotChdir())); - actOpen = new QAction(tr("&Open"), this); + actOpen = mtnew(QAction, tr("&Open"), this); actOpen->setStatusTip(tr("Open in default program")); connect(actOpen, SIGNAL(triggered()), this, SLOT(slotOpen())); - actAdd = new QAction(tr("&Add"), this); + actAdd = mtnew(QAction, tr("&Add"), this); actAdd->setStatusTip(tr("Add to workspace")); connect(actAdd, SIGNAL(triggered()), this, SLOT(slotAdd())); - actRemove = new QAction(tr("&Remove"), this); + actRemove = mtnew(QAction, tr("&Remove"), this); actRemove->setStatusTip(tr("Remove from workspace")); connect(actRemove, SIGNAL(triggered()), this, SLOT(slotRemove())); - actCommit = new QAction(tr("&Commit"), this); + actCommit = mtnew(QAction, tr("&Commit"), this); actCommit->setStatusTip(tr("Commit")); connect(actCommit, SIGNAL(triggered()), this, SLOT(slotCommit())); - actIgnore = new QAction(tr("I&gnore"), this); + actIgnore = mtnew(QAction, tr("I&gnore"), this); actIgnore->setStatusTip(tr("Ignore file")); connect(actIgnore, SIGNAL(triggered()), this, SLOT(slotIgnore())); - actUnignore = new QAction(tr("&Unignore"), this); + actUnignore = mtnew(QAction, tr("&Unignore"), this); actUnignore->setStatusTip(tr("Unignore file")); connect(actUnignore, SIGNAL(triggered()), this, SLOT(slotUnignore())); - actRevert = new QAction(tr("R&evert"), this); + actRevert = mtnew(QAction, tr("R&evert"), this); actRevert->setStatusTip(tr("Revert uncommitted changes")); connect(actRevert, SIGNAL(triggered()), this, SLOT(slotRevert())); - actFileDiff = new QAction(tr("D&iff"), this); + actFileDiff = mtnew(QAction, tr("D&iff"), this); actFileDiff->setStatusTip(tr("Diff against base revision")); connect(actFileDiff, SIGNAL(triggered()), this, SLOT(slotFileDiff())); - actRevisionDiff = new QAction(tr("D&iff all"), this); + actRevisionDiff = mtnew(QAction, tr("D&iff all"), this); actRevisionDiff->setStatusTip(tr("Show all differences")); connect(actRevisionDiff, SIGNAL(triggered()), this, SLOT(slotRevisionDiff())); - actRename = new QAction(tr("Rena&me"), this); + actRename = mtnew(QAction, tr("Rena&me"), this); actRename->setStatusTip(tr("Rename file")); connect(actRename, SIGNAL(triggered()), this, SLOT(slotRename())); } ============================================================ --- guitone/src/view/MainWindow.cpp 928c4689e62b90d92c0f5ee990b80133f3c77d71 +++ guitone/src/view/MainWindow.cpp 5e74f5b51c0d5ceee5eecd65171e699abb09f982 @@ -91,12 +91,12 @@ bool MainWindow::init() } // create the main models - invModel = new Inventory(this); - attrModel = new Attributes(this); + invModel = mtnew(Inventory, this); + attrModel = mtnew(Attributes, this); // ProxyModels - proxyModelFolderTree = new InventoryProxyModel(this, true); - proxyModelFileList = new InventoryProxyModel(this, false); + proxyModelFolderTree = mtnew(InventoryProxyModel, this, true); + proxyModelFileList = mtnew(InventoryProxyModel, this, false); proxyModelFolderTree->setSourceModel(invModel); proxyModelFileList->setSourceModel(invModel); @@ -176,7 +176,7 @@ void MainWindow::quit() void MainWindow::quit() { - delete this; + mtdelete(this); Settings::sync(); } ============================================================ --- guitone/src/view/dialogs/DatabaseView.cpp 46f48c4b9060cb37cb8a28f6b652a599e131ffa9 +++ guitone/src/view/dialogs/DatabaseView.cpp 409adc79ca2856f04777b22233321f3267b495da @@ -44,7 +44,7 @@ DatabaseView::DatabaseView(QWidget *pare connect(toolTree, SIGNAL(clicked()), this, SLOT(toggleTree())); - changesetModel = new ChangesetModel(this); + changesetModel = mtnew(ChangesetModel, this); changesets->setModel(changesetModel); changesets->setRootIsDecorated(false); @@ -82,7 +82,7 @@ void DatabaseView::initTreeWidget() void DatabaseView::initTreeWidget() { - branchModel = new Branches(tree, this); + branchModel = mtnew(Branches, tree, this); branchModel->readBranches(); branches->setRootIsDecorated(false); branches->setModel(branchModel); ============================================================ --- guitone/src/view/dialogs/FileDiff.cpp d50964c71c13049a79af8271ed4a8a0c98112d73 +++ guitone/src/view/dialogs/FileDiff.cpp d698dbe33ae62fec978cf9bef97a19e799b94374 @@ -56,10 +56,10 @@ void FileDiff::init(QString fileName) QString title = windowTitle(); setWindowTitle(title.arg(fileName)); - fileModel = new GetFile(this); + fileModel = mtnew(GetFile, this); fileModel->readFileByName(fileName); - fileProxyModel = new GetFileProxyModel(this); + fileProxyModel = mtnew(GetFileProxyModel, this); fileProxyModel->setSourceModel(fileModel); diffView->setModel(fileProxyModel); @@ -72,7 +72,7 @@ void FileDiff::init(QString fileName) if (fileWaiter.wait()) { - diffModel = new ContentDiff(this); + diffModel = mtnew(ContentDiff, this); diffModel->readDiff(fileName); SignalWaiter diffWaiter(diffModel, SIGNAL(diffRead())); ============================================================ --- guitone/src/view/dialogs/KeyManagement.cpp a57f544194f11df59d66b4dd2447c24ff899ae9d +++ guitone/src/view/dialogs/KeyManagement.cpp 16a63b656dce70739afccdd507bb68c400cd029d @@ -36,7 +36,7 @@ KeyManagement::KeyManagement(QWidget* pa // OSX sheet-alike dialog setWindowFlags(Qt::Sheet); - model = new Keys(this); + model = mtnew(Keys, this); keyList->setModel(model); if (!model->readKeys()) @@ -56,17 +56,17 @@ KeyManagement::KeyManagement(QWidget* pa this, SLOT(generateKeypair()) ); - popupMenu = new QMenu(this); + popupMenu = mtnew(QMenu, this); - QAction * act = new QAction(tr("Copy key name to clipboard"), this); + QAction * act = mtnew(QAction, tr("Copy key name to clipboard"), this); connect(act, SIGNAL(triggered()), this, SLOT(copyKeyNameToClipboard())); popupMenu->addAction(act); - act = new QAction(tr("Copy public key hash to clipboard"), this); + act = mtnew(QAction, tr("Copy public key hash to clipboard"), this); connect(act, SIGNAL(triggered()), this, SLOT(copyPubkeyHashToClipboard())); popupMenu->addAction(act); - act = new QAction(tr("Copy public key data to clipboard"), this); + act = mtnew(QAction, tr("Copy public key data to clipboard"), this); connect(act, SIGNAL(triggered()), this, SLOT(copyPubkeyDataToClipboard())); popupMenu->addAction(act); } ============================================================ --- guitone/src/view/dialogs/RevisionDiff.cpp 63eb939175650c01c82ce8e7252f88f69c84fc80 +++ guitone/src/view/dialogs/RevisionDiff.cpp 9795c6fabe86a1ac4f71248c038c3516c81c95f5 @@ -63,7 +63,7 @@ void RevisionDiff::init(QString path, QS setWindowTitle(title); - diffModel = new ContentDiff(this); + diffModel = mtnew(ContentDiff, this); diffView->setModel(diffModel); // FIXME: proper error handling here ============================================================ --- guitone/src/view/dialogs/RevisionManifest.cpp 87c413184dee30b528d784b2f67d448d45f10ff7 +++ guitone/src/view/dialogs/RevisionManifest.cpp f68113f5bc124de858b097d136e59c162f7d6485 @@ -35,7 +35,7 @@ RevisionManifest::RevisionManifest(QWidg setWindowTitle(windowTitle().arg(revision)); - manifestModel = new Manifest(this); + manifestModel = mtnew(Manifest, this); manifestView->setModel(manifestModel); connect( @@ -67,7 +67,7 @@ RevisionManifest::~RevisionManifest() RevisionManifest::~RevisionManifest() { - delete manifestModel; + mtdelete(manifestModel); } void RevisionManifest::saveAllFiles() ============================================================ --- guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp 4577dc3fa56e55ccfe2cbcfe3e31a413f9148f80 +++ guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp 4ff7c85d7e1154607ce8ec0ba7ed263acc93158c @@ -47,12 +47,12 @@ SwitchWorkspaceRevision::SwitchWorkspace selectorBox->addItem(tr("Combined"), ""); // create the models - selectorModel = new Select(this); - sortModel = new Toposort(this); - certsModel = new Certs(this); - branchesModel = new Branches(false, this); - tagsModel = new Tags(this); - keysModel = new Keys(this); + selectorModel = mtnew(Select, this); + sortModel = mtnew(Toposort, this); + certsModel = mtnew(Certs, this); + branchesModel = mtnew(Branches, false, this); + tagsModel = mtnew(Tags, this); + keysModel = mtnew(Keys, this); // toposort revisions sortModel->setSourceModel(selectorModel); @@ -137,12 +137,12 @@ SwitchWorkspaceRevision::~SwitchWorkspac SwitchWorkspaceRevision::~SwitchWorkspaceRevision() { - delete selectorModel; - delete sortModel; - delete certsModel; - delete branchesModel; - delete tagsModel; - delete keysModel; + mtdelete(selectorModel); + mtdelete(sortModel); + mtdelete(certsModel); + mtdelete(branchesModel); + mtdelete(tagsModel); + mtdelete(keysModel); } void SwitchWorkspaceRevision::triggerRevisionSearch() @@ -231,7 +231,7 @@ void SwitchWorkspaceRevision::setComplet if (selector == "t") { tagsModel->readTags(QString()); - selectorCompleter = new QCompleter(this); + selectorCompleter = mtnew(QCompleter, this); selectorCompleter->setCaseSensitivity(Qt::CaseInsensitive); selectorCompleter->setModel(tagsModel); selectorCompleter->setCompletionRole(Qt::DisplayRole); @@ -242,7 +242,7 @@ void SwitchWorkspaceRevision::setComplet if (selector == "a") { keysModel->readKeys(); - selectorCompleter = new QCompleter(this); + selectorCompleter = mtnew(QCompleter, this); selectorCompleter->setCaseSensitivity(Qt::CaseInsensitive); selectorCompleter->setModel(keysModel); selectorCompleter->setCompletionRole(Qt::DisplayRole); @@ -253,7 +253,7 @@ void SwitchWorkspaceRevision::setComplet if (selector == "b") { branchesModel->readBranches(); - selectorCompleter = new QCompleter(this); + selectorCompleter = mtnew(QCompleter, this); selectorCompleter->setCaseSensitivity(Qt::CaseInsensitive); selectorCompleter->setModel(branchesModel); selectorCompleter->setCompletionRole(Qt::DisplayRole);