From a521525c4dd98180152cb31a7a1e324929cfe928 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sun, 19 Jun 2022 19:16:51 -0700 Subject: [PATCH] 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. --- src/internalwindow.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/internalwindow.cpp b/src/internalwindow.cpp index 50bce553eb..aad66d6266 100644 --- a/src/internalwindow.cpp +++ b/src/internalwindow.cpp @@ -119,7 +119,14 @@ bool InternalWindow::eventFilter(QObject *watched, QEvent *event) setSkipCloseAnimation(m_handle->property(s_skipClosePropertyName).toBool()); } if (pe->propertyName() == s_shadowEnabledPropertyName) { - updateShadow(); + // 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();