diff --git a/plugins/contextbrowser/contextbrowser.cpp b/plugins/contextbrowser/contextbrowser.cpp index 07006311dcc23009c565dd1572b0a4984a2509e7..41dc9ff15bbe6ca584ce021a0fe4dc75b212355f 100644 --- a/plugins/contextbrowser/contextbrowser.cpp +++ b/plugins/contextbrowser/contextbrowser.cpp @@ -329,6 +329,11 @@ ContextBrowserPlugin::ContextBrowserPlugin(QObject* parent, const QVariantList&) ContextBrowserPlugin::~ContextBrowserPlugin() { + for (auto* view : qAsConst(m_textHintProvidedViews)) { + auto* iface = qobject_cast(view); + iface->unregisterTextHintProvider(&m_textHintProvider); + } + ///TODO: QObject inheritance should suffice? delete m_nextMenu; delete m_previousMenu; @@ -976,6 +981,7 @@ void ContextBrowserPlugin::viewDestroyed(QObject* obj) { m_highlightedRanges.remove(static_cast(obj)); m_updateViews.remove(static_cast(obj)); + m_textHintProvidedViews.removeOne(static_cast(obj)); } void ContextBrowserPlugin::selectionChanged(View* view) @@ -1024,8 +1030,12 @@ void ContextBrowserPlugin::viewCreated(KTextEditor::Document*, View* v) if (!iface) return; + if (m_textHintProvidedViews.contains(v)) { + return; + } iface->setTextHintDelay(highlightingTimeout); iface->registerTextHintProvider(&m_textHintProvider); + m_textHintProvidedViews.append(v); } void ContextBrowserPlugin::registerToolView(ContextBrowserView* view) diff --git a/plugins/contextbrowser/contextbrowser.h b/plugins/contextbrowser/contextbrowser.h index 439f37ccaa14db1787dfdc35e4a317d54f8aff5f..fb3a16b9e93b16e3358838ea0dcfbd84e8e6e9d9 100644 --- a/plugins/contextbrowser/contextbrowser.h +++ b/plugins/contextbrowser/contextbrowser.h @@ -228,6 +228,8 @@ private: //Holds a list of all active context browser tool views QList m_views; + QVector m_textHintProvidedViews; + //Used to override the next declaration that will be highlighted KDevelop::IndexedDeclaration m_useDeclaration; KDevelop::IndexedDeclaration m_lastHighlightedDeclaration;