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 TextEditorPlugin *m_instance = nullptr;
|
||||||
static TextEditorPluginPrivate *dd = nullptr;
|
|
||||||
|
|
||||||
TextEditorPlugin::TextEditorPlugin()
|
TextEditorPlugin::TextEditorPlugin()
|
||||||
{
|
{
|
||||||
@@ -96,8 +95,8 @@ TextEditorPlugin::TextEditorPlugin()
|
|||||||
|
|
||||||
TextEditorPlugin::~TextEditorPlugin()
|
TextEditorPlugin::~TextEditorPlugin()
|
||||||
{
|
{
|
||||||
delete dd;
|
delete d;
|
||||||
dd = nullptr;
|
d = nullptr;
|
||||||
m_instance = nullptr;
|
m_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,13 +105,12 @@ TextEditorPlugin *TextEditorPlugin::instance()
|
|||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtensionSystem::PluginInterface
|
|
||||||
bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
dd = new TextEditorPluginPrivate;
|
d = new TextEditorPluginPrivate;
|
||||||
|
|
||||||
Context context(TextEditor::Constants::C_TEXTEDITOR);
|
Context context(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
|
|
||||||
@@ -171,7 +169,7 @@ void TextEditorPluginPrivate::extensionsInitialized()
|
|||||||
|
|
||||||
void TextEditorPlugin::extensionsInitialized()
|
void TextEditorPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
dd->extensionsInitialized();
|
d->extensionsInitialized();
|
||||||
|
|
||||||
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
|
|
||||||
@@ -224,7 +222,7 @@ void TextEditorPlugin::extensionsInitialized()
|
|||||||
|
|
||||||
LineNumberFilter *TextEditorPlugin::lineNumberFilter()
|
LineNumberFilter *TextEditorPlugin::lineNumberFilter()
|
||||||
{
|
{
|
||||||
return &dd->lineNumberFilter;
|
return &m_instance->d->lineNumberFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorPluginPrivate::updateSearchResultsFont(const FontSettings &settings)
|
void TextEditorPluginPrivate::updateSearchResultsFont(const FontSettings &settings)
|
||||||
|
@@ -48,6 +48,8 @@ private:
|
|||||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||||
void extensionsInitialized() final;
|
void extensionsInitialized() final;
|
||||||
|
|
||||||
|
class TextEditorPluginPrivate *d = nullptr;
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
private slots:
|
private slots:
|
||||||
void testSnippetParsing_data();
|
void testSnippetParsing_data();
|
||||||
|
Reference in New Issue
Block a user