win: fix null pointer access in some rare cases
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
012721d9a0
commit
6b1a37a82a
|
@ -531,11 +531,6 @@ static inline void themeChangeNotificationCallback()
|
||||||
|
|
||||||
void Utils::registerThemeChangeNotification()
|
void Utils::registerThemeChangeNotification()
|
||||||
{
|
{
|
||||||
static bool reg = false;
|
|
||||||
if (reg) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reg = true;
|
|
||||||
GtkSettings * const settings = gtk_settings_get_default();
|
GtkSettings * const settings = gtk_settings_get_default();
|
||||||
Q_ASSERT(settings);
|
Q_ASSERT(settings);
|
||||||
if (!settings) {
|
if (!settings) {
|
||||||
|
|
|
@ -1829,6 +1829,12 @@ void Utils::disableOriginalTitleBarFunctionalities(const WId windowId, const boo
|
||||||
void Utils::setQtDarkModeAwareEnabled(const bool enable, const bool pureQuick)
|
void Utils::setQtDarkModeAwareEnabled(const bool enable, const bool pureQuick)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#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;
|
using App = QNativeInterface::Private::QWindowsApplication;
|
||||||
if (const auto app = qApp->nativeInterface<App>()) {
|
if (const auto app = qApp->nativeInterface<App>()) {
|
||||||
app->setDarkModeHandling([enable, pureQuick]() -> App::DarkModeHandling {
|
app->setDarkModeHandling([enable, pureQuick]() -> App::DarkModeHandling {
|
||||||
|
|
Loading…
Reference in New Issue