diff options
author | q234rty <q23456yuiop@gmail.com> | 2023-12-29 14:51:37 +0800 |
---|---|---|
committer | q234rty <q23456yuiop@gmail.com> | 2024-01-08 17:22:46 +0800 |
commit | 2ced20d755739c7e32a8f8e72a8ac186046b2b0f (patch) | |
tree | ca56f8b6d256a98ac0f1ce07acb9252a576bfcf2 /src/MainWindow.cpp | |
parent | Disable reuseItems again, since it still breaks on room switch (diff) | |
download | nheko-2ced20d755739c7e32a8f8e72a8ac186046b2b0f.tar.xz |
Use dynamic properties for NhekoFixupPaletteEventFilter
A new window could have the same `QWindow *` value as an already free'ed window, so using a `QSet<QWindow *>` with potentially free'ed windows might not be reliable. Use dynamic properties instead.
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r-- | src/MainWindow.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index a4a0eff0..9b2626cf 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -201,14 +201,12 @@ NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event) // reason?!? if (event->type() == QEvent::ChildAdded && obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) { - QSet<QWindow *> newWindows; for (const auto window : QGuiApplication::topLevelWindows()) { - newWindows.insert(window); - if (m_postedWindows.contains(window)) + if (window->property("posted").isValid()) continue; QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange)); + window->setProperty("posted", true); } - m_postedWindows.swap(newWindows); } return false; } |