summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolsplugin.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-02-03 11:13:27 +0100
committerhjk <hjk@qt.io>2020-02-04 07:55:01 +0000
commit36f23df6c32330ecaf2b82002a3a14fb7fb55cc5 (patch)
tree0ae17c6b82ed045745e42268c8fddd84cb30fe66 /src/plugins/cpptools/cpptoolsplugin.cpp
parent85d9756c006dd5020fce07194b58157cd35626a2 (diff)
downloadqt-creator-36f23df6c32330ecaf2b82002a3a14fb7fb55cc5.tar.gz
CppTools: Use unshared object for CppCodeModelSettings
There's nothing shared here, only ever one copy. Ideally, this should be const outside CppToolsPlugin, but some settings are modified directly. Change-Id: I775b9151a244b3cc44d28bc992a041c42d234a18 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cpptoolsplugin.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolsplugin.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp
index d0d486e201..98a476569a 100644
--- a/src/plugins/cpptools/cpptoolsplugin.cpp
+++ b/src/plugins/cpptools/cpptoolsplugin.cpp
@@ -81,14 +81,12 @@ class CppToolsPluginPrivate
{
public:
CppToolsPluginPrivate()
- : m_codeModelSettings(new CppCodeModelSettings)
{
StringTable::initialize();
CppModelManager::createCppModelManager(m_instance);
m_settings = new CppToolsSettings(m_instance); // force registration of cpp tools settings
- m_codeModelSettings->fromSettings(ICore::settings());
+ m_codeModelSettings.fromSettings(ICore::settings());
m_cppFileSettingsPage = new CppFileSettingsPage(m_instance->m_fileSettings);
- m_cppCodeModelSettingsPage = new CppCodeModelSettingsPage(m_codeModelSettings);
m_cppCodeStyleSettingsPage = new CppCodeStyleSettingsPage;
}
@@ -96,16 +94,15 @@ public:
{
StringTable::destroy();
delete m_cppFileSettingsPage;
- delete m_cppCodeModelSettingsPage;
if (m_cppCodeStyleSettingsPage)
delete m_cppCodeStyleSettingsPage;
ExtensionSystem::PluginManager::removeObject(&m_cppProjectUpdaterFactory);
}
- QSharedPointer<CppCodeModelSettings> m_codeModelSettings;
+ CppCodeModelSettings m_codeModelSettings;
CppToolsSettings *m_settings = nullptr;
CppFileSettingsPage *m_cppFileSettingsPage = nullptr;
- CppCodeModelSettingsPage *m_cppCodeModelSettingsPage = nullptr;
+ CppCodeModelSettingsPage m_cppCodeModelSettingsPage{&m_codeModelSettings};
QPointer<CppCodeStyleSettingsPage> m_cppCodeStyleSettingsPage = nullptr;
CppProjectUpdaterFactory m_cppProjectUpdaterFactory;
};
@@ -231,9 +228,9 @@ void CppToolsPlugin::extensionsInitialized()
qWarning("Unable to apply cpp suffixes to mime database (cpp mime types not found).\n");
}
-QSharedPointer<CppCodeModelSettings> CppToolsPlugin::codeModelSettings() const
+CppCodeModelSettings *CppToolsPlugin::codeModelSettings()
{
- return d->m_codeModelSettings;
+ return &d->m_codeModelSettings;
}
void CppToolsPlugin::switchHeaderSource()