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.
This commit is contained in:
parent
fa53b5b5f3
commit
2ced20d755
@ -201,14 +201,12 @@ NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event)
|
|||||||
// reason?!?
|
// reason?!?
|
||||||
if (event->type() == QEvent::ChildAdded &&
|
if (event->type() == QEvent::ChildAdded &&
|
||||||
obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) {
|
obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) {
|
||||||
QSet<QWindow *> newWindows;
|
|
||||||
for (const auto window : QGuiApplication::topLevelWindows()) {
|
for (const auto window : QGuiApplication::topLevelWindows()) {
|
||||||
newWindows.insert(window);
|
if (window->property("posted").isValid())
|
||||||
if (m_postedWindows.contains(window))
|
|
||||||
continue;
|
continue;
|
||||||
QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
|
QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
|
||||||
|
window->setProperty("posted", true);
|
||||||
}
|
}
|
||||||
m_postedWindows.swap(newWindows);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
private:
|
|
||||||
QSet<QWindow *> m_postedWindows;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MainWindow : public QQuickView
|
class MainWindow : public QQuickView
|
||||||
|
Loading…
Reference in New Issue
Block a user