PythonEditor: Remove uses of global object pool

Change-Id: Iba9903ca994a0e9aef268685269789daf2b83183
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-02-06 12:46:02 +01:00
parent 0b33500655
commit 0bbf224667
2 changed files with 12 additions and 10 deletions

View File

@@ -571,16 +571,19 @@ void PythonRunConfigurationWidget::setInterpreter(const QString &interpreter)
// //
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
static PythonEditorPlugin *m_instance = 0; class PythonEditorPluginPrivate
PythonEditorPlugin::PythonEditorPlugin()
{ {
m_instance = this; public:
} PythonEditorFactory editorFactory;
PythonRunConfigurationFactory runConfigFactory;
};
static PythonEditorPluginPrivate *dd = nullptr;
PythonEditorPlugin::~PythonEditorPlugin() PythonEditorPlugin::~PythonEditorPlugin()
{ {
m_instance = 0; delete dd;
dd = nullptr;
} }
bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) 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(arguments)
Q_UNUSED(errorMessage) Q_UNUSED(errorMessage)
ProjectManager::registerProjectType<PythonProject>(PythonMimeType); dd = new PythonEditorPluginPrivate;
addAutoReleasedObject(new PythonEditorFactory); ProjectManager::registerProjectType<PythonProject>(PythonMimeType);
addAutoReleasedObject(new PythonRunConfigurationFactory);
auto constraint = [](RunConfiguration *runConfiguration) { auto constraint = [](RunConfiguration *runConfiguration) {
auto rc = dynamic_cast<PythonRunConfiguration *>(runConfiguration); auto rc = dynamic_cast<PythonRunConfiguration *>(runConfiguration);

View File

@@ -36,7 +36,7 @@ class PythonEditorPlugin : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "PythonEditor.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "PythonEditor.json")
public: public:
PythonEditorPlugin(); PythonEditorPlugin() = default;
~PythonEditorPlugin() override; ~PythonEditorPlugin() override;
bool initialize(const QStringList &arguments, QString *errorMessage) override; bool initialize(const QStringList &arguments, QString *errorMessage) override;