diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-03-11 17:04:37 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-03-12 15:48:34 +0100 |
commit | 7da5842647f75fd990f69f400f75d9b090e39306 (patch) | |
tree | 76559c1c295b6bf7362737c0f1b70c8911c3cefc /src/imports/controls | |
parent | 92dc998f6d27347842fd57b0a1c6220426eb9ee2 (diff) |
Adapt to plugin unloading changes
As of c2081016e in qtdeclarative, plugins are no longer unloaded on
macOS, and QQmlExtensionPlugin::unregisterTypes() should be used
instead.
This patch:
- Moves everything that was done in destructors to unregisterTypes().
- Ensures that the style selector is destroyed in
QQuickStylePlugin::unregisterTypes() so that previous styles that
were set do not stick around after qmlClearTypeRegistrations() is
called. This ensures that runtime style-switching continues to work.
- Adds more logging output to make it easier to diagnose issues in the
future.
- Adds more code comments to ease maintenance.
Change-Id: Ibbfeba4501d6ba0d5a257dcceace3498904a816e
Fixes: QTBUG-82811
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/imports/controls')
-rw-r--r-- | src/imports/controls/qtquickcontrols2plugin.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index e0f18467..6730848f 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -79,6 +79,7 @@ public: ~QtQuickControls2Plugin(); void registerTypes(const char *uri) override; + void unregisterTypes() override; QString name() const override; void initializeTheme(QQuickTheme *theme) override; @@ -94,7 +95,8 @@ QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlu QtQuickControls2Plugin::~QtQuickControls2Plugin() { - QQuickStylePrivate::reset(); + // Intentionally empty: we use register/unregisterTypes() to do + // initialization and cleanup, as plugins are not unloaded on macOS. } static bool isDefaultStyle(const QString &style) @@ -238,6 +240,12 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterRevision<QQuickText, 6>(import, 2, 3); } +void QtQuickControls2Plugin::unregisterTypes() +{ + QQuickStylePlugin::unregisterTypes(); + QQuickStylePrivate::reset(); +} + QString QtQuickControls2Plugin::name() const { return QStringLiteral("Default"); |