# # # patch "src/model/Workspace.cpp" # from [c4614529bfd35c10621950a90016393d867353b6] # to [6012ea1274d1a6e50a2bcc3f640616fd0e456c06] # # patch "src/model/Workspace.h" # from [b2a2b0f4cd224bdaff39b675ca7ec0e4958e534b] # to [a9ac053fdcd88967dd9abbbd12b80f406b9f1639] # ============================================================ --- src/model/Workspace.cpp c4614529bfd35c10621950a90016393d867353b6 +++ src/model/Workspace.cpp 6012ea1274d1a6e50a2bcc3f640616fd0e456c06 @@ -93,7 +93,7 @@ std::map::iterator renameIter; WorkspaceItem *item; - QList tempItems; + QList* tempItems = new QList(); for (QStringList::Iterator it = output->begin(); it != output->end(); ++it) { @@ -184,7 +184,7 @@ { renameMap[to_id] = item; } - tempItems.push_back(item); + tempItems->push_back(item); } int id = 0; @@ -198,8 +198,10 @@ renameMap[-id]->setRenamedTo(renameMap[id]); } - rootItem->setChildren(buildTreeRecursive(tempItems, NULL)); + rootItem->setChildren(*(buildTreeRecursive(tempItems, NULL))); + delete tempItems; + // reset the model to repaint the view completly // (all QModelIndexes are discarded through that, e.g. selections!) this->reset(); @@ -208,9 +210,9 @@ qApp->restoreOverrideCursor(); } -QList Workspace::buildTreeRecursive(QList items, WorkspaceItem* parentItem) +QList* Workspace::buildTreeRecursive(QList* items, WorkspaceItem* parentItem) { - QList finalItems; + QList* finalItems = new QList(); WorkspaceItem *currentItem; QString parentPath = ""; @@ -220,9 +222,9 @@ parentPath = parentItem->getPath(); } - while (items.size() > 0) + while (items->size() > 0) { - currentItem = items.front(); + currentItem = items->front(); // // if the item is not directly inside the current path stop immediately @@ -238,18 +240,19 @@ } // remove the item if we can append it now - items.pop_front(); + items->pop_front(); // // it seems to be a valid item // // append item to final list - finalItems.push_back(currentItem); + qDebug("pushed back %s", currentItem->getPath().latin1()); + finalItems->push_back(currentItem); // if the item is directory a directory, make sure we catch decendant items... recursion! if (currentItem->isDirectory()) { - currentItem->setChildren(buildTreeRecursive(items, currentItem)); + currentItem->setChildren(*(buildTreeRecursive(items, currentItem))); } } return finalItems; ============================================================ --- src/model/Workspace.h b2a2b0f4cd224bdaff39b675ca7ec0e4958e534b +++ src/model/Workspace.h a9ac053fdcd88967dd9abbbd12b80f406b9f1639 @@ -49,7 +49,7 @@ int columnCount(const QModelIndex&) const; private: - QList buildTreeRecursive(QList, WorkspaceItem*); + QList* buildTreeRecursive(QList*, WorkspaceItem*); QDir *workspaceDir; Monotone *monotone; WorkspaceItem *rootItem;