forked from qt-creator/qt-creator
TextEditor: Use a non-static d-ptr
Change-Id: I21ae4599f152964166c65095996e3fc4ac417ba5 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -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)
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user