From 121e72106741e19d4dde5d9194fb31cb72677a51 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 25 Jan 2019 15:48:24 +0100 Subject: [PATCH] Help: Avoid looking up invalid help ID over and over again Make the help link cache remember that it tried before. Change-Id: Id9d07a7b86c4fa856b7fa3a5e17cd5d4115861ff Reviewed-by: David Schulz --- src/plugins/coreplugin/helpitem.cpp | 4 ++-- src/plugins/coreplugin/helpitem.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/coreplugin/helpitem.cpp b/src/plugins/coreplugin/helpitem.cpp index a5025b1b6e6..66e6d7a50bf 100644 --- a/src/plugins/coreplugin/helpitem.cpp +++ b/src/plugins/coreplugin/helpitem.cpp @@ -144,7 +144,7 @@ QString HelpItem::extractContent(bool extended) const QMap HelpItem::links() const { - if (m_helpLinks.isEmpty()) + if (!m_helpLinks) m_helpLinks = Core::HelpManager::linksForIdentifier(m_helpId); - return m_helpLinks; + return *m_helpLinks; } diff --git a/src/plugins/coreplugin/helpitem.h b/src/plugins/coreplugin/helpitem.h index 496e32ffe7d..bca8d1d2c7e 100644 --- a/src/plugins/coreplugin/helpitem.h +++ b/src/plugins/coreplugin/helpitem.h @@ -27,6 +27,8 @@ #include "core_global.h" +#include + #include #include #include @@ -77,7 +79,7 @@ private: QString m_helpId; QString m_docMark; Category m_category = Unknown; - mutable QMap m_helpLinks; // cached help links + mutable Utils::optional> m_helpLinks; // cached help links }; } // namespace Core