diff --git a/src/core/utils_linux.cpp b/src/core/utils_linux.cpp index d8d66c7..625b1c8 100644 --- a/src/core/utils_linux.cpp +++ b/src/core/utils_linux.cpp @@ -531,11 +531,6 @@ static inline void themeChangeNotificationCallback() void Utils::registerThemeChangeNotification() { - static bool reg = false; - if (reg) { - return; - } - reg = true; GtkSettings * const settings = gtk_settings_get_default(); Q_ASSERT(settings); if (!settings) { diff --git a/src/core/utils_win.cpp b/src/core/utils_win.cpp index 0e9decf..5e7c033 100644 --- a/src/core/utils_win.cpp +++ b/src/core/utils_win.cpp @@ -1829,6 +1829,12 @@ void Utils::disableOriginalTitleBarFunctionalities(const WId windowId, const boo void Utils::setQtDarkModeAwareEnabled(const bool enable, const bool pureQuick) { #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + // We'll call QPA functions, so we have to ensure that the QGuiApplication + // instance has already been created and initialized, because the platform + // integration infrastructure is created and maintained by QGuiApplication. + if (!qGuiApp) { + return; + } using App = QNativeInterface::Private::QWindowsApplication; if (const auto app = qApp->nativeInterface()) { app->setDarkModeHandling([enable, pureQuick]() -> App::DarkModeHandling {