Delegate updateShadow to event loop.

If PlasmaCore.Dialog resizes while visible, the kwin shadow property
used by InternalWindow may update the shadow during rendering and cause
crash related to current context.
This commit is contained in:
Weng Xuetian 2022-06-19 19:16:51 -07:00 committed by Xuetian Weng
parent 6838b1132f
commit a521525c4d

View file

@ -119,7 +119,14 @@ bool InternalWindow::eventFilter(QObject *watched, QEvent *event)
setSkipCloseAnimation(m_handle->property(s_skipClosePropertyName).toBool());
}
if (pe->propertyName() == s_shadowEnabledPropertyName) {
// Some dialog e.g. Plasma::Dialog may update shadow in the middle of rendering.
// The opengl context changed by updateShadow may break the QML Window rendering
// and cause crash.
QMetaObject::invokeMethod(
this, [this]() {
updateShadow();
},
Qt::QueuedConnection);
}
if (pe->propertyName() == "kwin_windowType") {
m_windowType = m_handle->property("kwin_windowType").value<NET::WindowType>();