all debuggers: fix VariableCollection to unregister as texthinter provider

CCBUG: 411371
parent 36ab2338
......@@ -476,6 +476,10 @@ void VariableCollection::updateAutoUpdate(IDebugSession* session)
VariableCollection::~ VariableCollection()
{
for (auto* view : qAsConst(m_textHintProvidedViews)) {
auto* iface = qobject_cast<KTextEditor::TextHintInterface*>(view);
iface->unregisterTextHintProvider(&m_textHintProvider);
}
}
void VariableCollection::textDocumentCreated(IDocument* doc)
......@@ -499,7 +503,18 @@ void VariableCollection::viewCreated(KTextEditor::Document* doc,
if( !iface )
return;
if (m_textHintProvidedViews.contains(view)) {
return;
}
connect(view, &View::destroyed, this, &VariableCollection::viewDestroyed);
iface->registerTextHintProvider(&m_textHintProvider);
m_textHintProvidedViews.append(view);
}
void VariableCollection::viewDestroyed(QObject* obj)
{
m_textHintProvidedViews.removeOne(static_cast<KTextEditor::View*>(obj));
}
Locals* VariableCollection::locals(const QString &name) const
......
......@@ -238,6 +238,7 @@ private Q_SLOTS:
void textDocumentCreated( KDevelop::IDocument*);
void viewCreated(KTextEditor::Document*, KTextEditor::View*);
void viewDestroyed(QObject* obj);
private:
VariablesRoot* m_universe;
......@@ -246,6 +247,8 @@ private:
friend class VariableProvider;
VariableProvider m_textHintProvider;
QVector<KTextEditor::View*> m_textHintProvidedViews;
};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment