forked from qt-creator/qt-creator
Debugger: fix vanishing editor tooltip on expand
fetchMore is called multiple times before expandNode and seems to invalidate the index that is passed to expandNode. Since we only need to fetch more when we want to expand the item we might as well just integrate the code of fetch more into expandNode. Fixes: QTCREATORBUG-29083 Change-Id: I0e60e9bb03b53de2e86eea232fb5bb98046bbb80 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -266,9 +266,20 @@ public:
|
||||
|
||||
void expandNode(const QModelIndex &idx)
|
||||
{
|
||||
if (!m_engine)
|
||||
return;
|
||||
|
||||
m_expandedINames.insert(idx.data(LocalsINameRole).toString());
|
||||
if (canFetchMore(idx))
|
||||
fetchMore(idx);
|
||||
if (canFetchMore(idx)) {
|
||||
if (!idx.isValid())
|
||||
return;
|
||||
|
||||
if (auto item = dynamic_cast<ToolTipWatchItem *>(itemForIndex(idx))) {
|
||||
WatchItem *it = m_engine->watchHandler()->findItem(item->iname);
|
||||
if (QTC_GUARD(it))
|
||||
it->model()->fetchMore(it->index());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void collapseNode(const QModelIndex &idx)
|
||||
@@ -276,22 +287,6 @@ public:
|
||||
m_expandedINames.remove(idx.data(LocalsINameRole).toString());
|
||||
}
|
||||
|
||||
void fetchMore(const QModelIndex &idx) override
|
||||
{
|
||||
if (!idx.isValid())
|
||||
return;
|
||||
auto item = dynamic_cast<ToolTipWatchItem *>(itemForIndex(idx));
|
||||
if (!item)
|
||||
return;
|
||||
QString iname = item->iname;
|
||||
if (!m_engine)
|
||||
return;
|
||||
|
||||
WatchItem *it = m_engine->watchHandler()->findItem(iname);
|
||||
QTC_ASSERT(it, return);
|
||||
it->model()->fetchMore(it->index());
|
||||
}
|
||||
|
||||
void restoreTreeModel(QXmlStreamReader &r);
|
||||
|
||||
QPointer<DebuggerEngine> m_engine;
|
||||
|
||||
Reference in New Issue
Block a user