diff options
author | David Schulz <david.schulz@theqtcompany.com> | 2015-05-20 13:57:06 +0200 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-05-21 11:08:00 +0000 |
commit | a33db02a3689ce19423cb3a2c66b651f97f84d8a (patch) | |
tree | be5d5e4a27b504284e0dda6493490f6f6b31cf8a | |
parent | 6d3f81b095bbab4c9ccf1ab92d2fd5c9643244a7 (diff) | |
download | qt-creator-a33db02a3689ce19423cb3a2c66b651f97f84d8a.tar.gz |
Debugger: Optimize insert watch item.
Change-Id: If15afbbc7bcf33367755cfd61d47670a28038e6f
Reviewed-by: hjk <hjk@theqtcompany.com>
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index a77b2d5738..0f3e8672d8 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1241,15 +1241,15 @@ void WatchHandler::insertItem(WatchItem *item) void WatchModel::insertItem(WatchItem *item) { - WatchItem *existing = findItem(item->iname); - if (existing) + WatchItem *parent = findItem(parentName(item->iname)); + QTC_ASSERT(parent, return); + + if (WatchItem *existing = parent->findItem(item->iname)) removeItem(existing); //item->walkTree([item](TreeItem *sub) { sub->sortChildren(&watchItemSorter); }); item->sortChildren(&watchItemSorter); - WatchItem *parent = findItem(parentName(item->iname)); - QTC_ASSERT(parent, return); const int row = findInsertPosition(parent->children(), item); parent->insertChild(row, item); |