diff options
| author | David Schulz <[email protected]> | 2024-10-22 10:50:08 +0200 |
|---|---|---|
| committer | David Schulz <[email protected]> | 2024-10-23 08:50:04 +0000 |
| commit | 48c311b8f354900fc4ce47bc2737aee1bab0809f (patch) | |
| tree | 07a92dd9cad8d823ae5fb96ea4ddbc65f985e8ac /src/plugins/python/pythonsettings.cpp | |
| parent | 74068743b64071f7e9e0c7e5546759d30c7bc9db (diff) | |
Python: do not access deleted widget in settingspage
Change-Id: Ibf7148255ac5a3bb26ec41684f7c96dd5c357ca5
Reviewed-by: Marcus Tillmanns <[email protected]>
Diffstat (limited to 'src/plugins/python/pythonsettings.cpp')
| -rw-r--r-- | src/plugins/python/pythonsettings.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index cf43807db37..6240499f2dc 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -318,33 +318,27 @@ public: setCategory(Constants::C_PYTHON_SETTINGS_CATEGORY); setDisplayCategory(Tr::tr("Python")); setCategoryIconPath(":/python/images/settingscategory_python.png"); - setWidgetCreator([this] { m_widget = new InterpreterOptionsWidget; return m_widget; }); + setWidgetCreator([] { return new InterpreterOptionsWidget(); }); } QList<Interpreter> interpreters() { - if (m_widget) - return m_widget->interpreters(); - return {}; + return static_cast<InterpreterOptionsWidget *>(widget())->interpreters(); } void addInterpreter(const Interpreter &interpreter) { - if (m_widget) - m_widget->addInterpreter(interpreter); + static_cast<InterpreterOptionsWidget *>(widget())->addInterpreter(interpreter); } void removeInterpreterFrom(const QString &detectionSource) { - if (m_widget) - m_widget->removeInterpreterFrom(detectionSource); + static_cast<InterpreterOptionsWidget *>(widget())->removeInterpreterFrom(detectionSource); } QList<Interpreter> interpreterFrom(const QString &detectionSource) { - if (m_widget) - return m_widget->interpreterFrom(detectionSource); - return {}; + return static_cast<InterpreterOptionsWidget *>(widget())->interpreterFrom(detectionSource); } QStringList keywords() const final @@ -358,9 +352,6 @@ public: Tr::tr("&Make Default") }; } - -private: - InterpreterOptionsWidget *m_widget = nullptr; }; static InterpreterOptionsPage &interpreterOptionsPage() |
