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:
authoralex-z <blackslayer4@gmail.com>2022-03-30 18:07:49 +0300
committeralex-z <blackslayer4@gmail.com>2022-03-30 18:07:49 +0300
commit0553f875b7b449f3a5d4a393a819ca25ba9111be (patch)
treee02939f6b5b2ada86dd2ab5909aacfe49896667b
parent0ccd35ef38606ac6b15c8fb5756d0292acdb1cc5 (diff)
Darkmode. Fix crash on exit.bufix/crash-on-exit
Signed-off-by: alex-z <blackslayer4@gmail.com>
-rw-r--r--src/libsync/theme.cpp11
-rw-r--r--src/libsync/theme.h2
2 files changed, 6 insertions, 7 deletions
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;