Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Gallien <matthieu_gallien@yahoo.fr>2022-04-01 12:15:33 +0300
committerGitHub <noreply@github.com>2022-04-01 12:15:33 +0300
commit02763d185c65cd0b005fa54e3527163c70593827 (patch)
tree30a1d8d0fb2b0b232f02f16021303a9001ed7869
parentc7992a4d68c3343516d62c8616e73674137310d6 (diff)
parent71b610eee3693732e3aa6cb80268a25133bcf270 (diff)
Merge pull request #4398 from nextcloud/bufix/crash-on-exit
Darkmode. Fix crash on exit.
-rw-r--r--src/gui/application.cpp14
-rw-r--r--src/gui/systray.h2
-rw-r--r--src/libsync/theme.cpp11
-rw-r--r--src/libsync/theme.h2
4 files changed, 8 insertions, 21 deletions
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 5320ade69..9fbd620eb 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -111,22 +111,12 @@ public:
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
const auto msg = static_cast<MSG *>(message);
if(msg->message == WM_SYSCOLORCHANGE || msg->message == WM_SETTINGCHANGE) {
- if(!_guiAppInstance) {
- const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance());
- if(ptr) {
- _guiAppInstance.reset(ptr);
- }
- }
-
- if(_guiAppInstance) {
- emit _guiAppInstance->paletteChanged(_guiAppInstance->palette());
+ if (const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance())) {
+ emit ptr->paletteChanged(ptr->palette());
}
}
return false;
}
-
-private:
- QScopedPointer<QGuiApplication> _guiAppInstance;
};
#endif
diff --git a/src/gui/systray.h b/src/gui/systray.h
index d5cdce358..0b4aabc3e 100644
--- a/src/gui/systray.h
+++ b/src/gui/systray.h
@@ -120,8 +120,6 @@ private:
QPointer<QQmlApplicationEngine> _trayEngine;
AccessManagerFactory _accessManagerFactory;
-
- QScopedPointer<QGuiApplication> _guiAppInstance;
};
} // namespace OCC
diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp
index 34bea7287..eb2268ca2 100644
--- a/src/libsync/theme.cpp
+++ b/src/libsync/theme.cpp
@@ -904,12 +904,11 @@ QColor Theme::errorBoxBorderColor() const
void Theme::connectToPaletteSignal()
{
- if(!_guiAppInstance) {
- const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance());
- if(ptr) {
- _guiAppInstance.reset(ptr);
- connect(_guiAppInstance.data(), &QGuiApplication::paletteChanged, this, &Theme::systemPaletteChanged);
- connect(_guiAppInstance.data(), &QGuiApplication::paletteChanged, this, &Theme::darkModeChanged);
+ if (!_paletteSignalsConnected) {
+ if (const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance())) {
+ connect(ptr, &QGuiApplication::paletteChanged, this, &Theme::systemPaletteChanged);
+ connect(ptr, &QGuiApplication::paletteChanged, this, &Theme::darkModeChanged);
+ _paletteSignalsConnected = true;
}
}
}
diff --git a/src/libsync/theme.h b/src/libsync/theme.h
index df9303b23..180efbec2 100644
--- a/src/libsync/theme.h
+++ b/src/libsync/theme.h
@@ -627,7 +627,7 @@ private:
static Theme *_instance;
bool _mono = false;
- QScopedPointer<QGuiApplication> _guiAppInstance;
+ bool _paletteSignalsConnected = false;
#ifndef TOKEN_AUTH_ONLY
mutable QHash<QString, QIcon> _iconCache;