From 0bbf224667da24d466a462c3af66f74adfa40226 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 6 Feb 2018 12:46:02 +0100 Subject: PythonEditor: Remove uses of global object pool Change-Id: Iba9903ca994a0e9aef268685269789daf2b83183 Reviewed-by: Christian Stenger --- src/plugins/pythoneditor/pythoneditorplugin.cpp | 20 +++++++++++--------- src/plugins/pythoneditor/pythoneditorplugin.h | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/plugins/pythoneditor') diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index 82e8a3812e..e83b2564d3 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -571,16 +571,19 @@ void PythonRunConfigurationWidget::setInterpreter(const QString &interpreter) // //////////////////////////////////////////////////////////////////////////////////// -static PythonEditorPlugin *m_instance = 0; - -PythonEditorPlugin::PythonEditorPlugin() +class PythonEditorPluginPrivate { - m_instance = this; -} +public: + PythonEditorFactory editorFactory; + PythonRunConfigurationFactory runConfigFactory; +}; + +static PythonEditorPluginPrivate *dd = nullptr; PythonEditorPlugin::~PythonEditorPlugin() { - m_instance = 0; + delete dd; + dd = nullptr; } bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) @@ -588,10 +591,9 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error Q_UNUSED(arguments) Q_UNUSED(errorMessage) - ProjectManager::registerProjectType(PythonMimeType); + dd = new PythonEditorPluginPrivate; - addAutoReleasedObject(new PythonEditorFactory); - addAutoReleasedObject(new PythonRunConfigurationFactory); + ProjectManager::registerProjectType(PythonMimeType); auto constraint = [](RunConfiguration *runConfiguration) { auto rc = dynamic_cast(runConfiguration); diff --git a/src/plugins/pythoneditor/pythoneditorplugin.h b/src/plugins/pythoneditor/pythoneditorplugin.h index 7c71142c25..26c86fe86c 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.h +++ b/src/plugins/pythoneditor/pythoneditorplugin.h @@ -36,7 +36,7 @@ class PythonEditorPlugin : public ExtensionSystem::IPlugin Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "PythonEditor.json") public: - PythonEditorPlugin(); + PythonEditorPlugin() = default; ~PythonEditorPlugin() override; bool initialize(const QStringList &arguments, QString *errorMessage) override; -- cgit v1.2.1