From d3bb3c09535963eb8b711edb08ee79b7dcc9a393 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 7 Feb 2018 10:14:23 +0100 Subject: [PATCH] TextEditor: Use a non-static d-ptr Change-Id: I21ae4599f152964166c65095996e3fc4ac417ba5 Reviewed-by: David Schulz --- src/plugins/texteditor/texteditorplugin.cpp | 12 +++++------- src/plugins/texteditor/texteditorplugin.h | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 6b11c4d3574..b0809ad094e 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -86,7 +86,6 @@ public: }; static TextEditorPlugin *m_instance = nullptr; -static TextEditorPluginPrivate *dd = nullptr; TextEditorPlugin::TextEditorPlugin() { @@ -96,8 +95,8 @@ TextEditorPlugin::TextEditorPlugin() TextEditorPlugin::~TextEditorPlugin() { - delete dd; - dd = nullptr; + delete d; + d = nullptr; m_instance = nullptr; } @@ -106,13 +105,12 @@ TextEditorPlugin *TextEditorPlugin::instance() return m_instance; } -// ExtensionSystem::PluginInterface bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments) Q_UNUSED(errorMessage) - dd = new TextEditorPluginPrivate; + d = new TextEditorPluginPrivate; Context context(TextEditor::Constants::C_TEXTEDITOR); @@ -171,7 +169,7 @@ void TextEditorPluginPrivate::extensionsInitialized() void TextEditorPlugin::extensionsInitialized() { - dd->extensionsInitialized(); + d->extensionsInitialized(); Utils::MacroExpander *expander = Utils::globalMacroExpander(); @@ -224,7 +222,7 @@ void TextEditorPlugin::extensionsInitialized() LineNumberFilter *TextEditorPlugin::lineNumberFilter() { - return &dd->lineNumberFilter; + return &m_instance->d->lineNumberFilter; } void TextEditorPluginPrivate::updateSearchResultsFont(const FontSettings &settings) diff --git a/src/plugins/texteditor/texteditorplugin.h b/src/plugins/texteditor/texteditorplugin.h index fcc938e010d..297cde9a8b5 100644 --- a/src/plugins/texteditor/texteditorplugin.h +++ b/src/plugins/texteditor/texteditorplugin.h @@ -48,6 +48,8 @@ private: bool initialize(const QStringList &arguments, QString *errorMessage) final; void extensionsInitialized() final; + class TextEditorPluginPrivate *d = nullptr; + #ifdef WITH_TESTS private slots: void testSnippetParsing_data();