summaryrefslogtreecommitdiff
path: root/src/plugins/pythoneditor
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-02-06 12:46:02 +0100
committerhjk <hjk@qt.io>2018-02-06 14:29:05 +0000
commit0bbf224667da24d466a462c3af66f74adfa40226 (patch)
treecff4d37a99d48544251dc2f016a8a53640e8e090 /src/plugins/pythoneditor
parent0b3350065521abdf83609147ed240772def03355 (diff)
downloadqt-creator-0bbf224667da24d466a462c3af66f74adfa40226.tar.gz
PythonEditor: Remove uses of global object pool
Change-Id: Iba9903ca994a0e9aef268685269789daf2b83183 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/pythoneditor')
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.cpp20
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.h2
2 files changed, 12 insertions, 10 deletions
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<PythonProject>(PythonMimeType);
+ dd = new PythonEditorPluginPrivate;
- addAutoReleasedObject(new PythonEditorFactory);
- addAutoReleasedObject(new PythonRunConfigurationFactory);
+ ProjectManager::registerProjectType<PythonProject>(PythonMimeType);
auto constraint = [](RunConfiguration *runConfiguration) {
auto rc = dynamic_cast<PythonRunConfiguration *>(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;