From 5517d4db2ce1e9fa2f662c31db53a7b68256385f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 14 Jul 2012 11:11:02 +0200 Subject: [PATCH] Delay closing of a window by one event cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an issue we already had in the past with Aurorae. When closing a window the graphics scene crashes because the deco gets destroyed before the code in the graphics scene finished the execution. With the port to QML this seemed to be fixed unless as it turns out it throws an XIO error on closing: fatal IO error 11 (Resource temporarily unavailable) on X server ":0" This can be triggered using glxgears. Closing glxgears would reliable crash Aurorae. To circumvent this issue we have to delay the close by one event cycle using QMetaObject's invokeMethod with a Qt::QueuedConnection. This has also to be done in the useractions menu as the menu is still open when the window closes causing the same problem inside Aurorae. BUG: 303450 FIXED-IN: 4.9.0 Reviewed-By: Thomas Lüking --- clients/aurorae/src/aurorae.cpp | 10 ++++++++++ clients/aurorae/src/aurorae.h | 2 ++ useractions.cpp | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index a8aee0f152..ed5942eff0 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -427,6 +427,16 @@ int AuroraeClient::doubleClickInterval() const return QApplication::doubleClickInterval(); } +void AuroraeClient::closeWindow() +{ + QMetaObject::invokeMethod(qobject_cast< KDecorationUnstable* >(this), "doCloseWindow", Qt::QueuedConnection); +} + +void AuroraeClient::doCloseWindow() +{ + KDecorationUnstable::closeWindow(); +} + } // namespace Aurorae extern "C" diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index 48211ee770..9c20787869 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -143,9 +143,11 @@ public slots: void titlePressed(Qt::MouseButton button, Qt::MouseButtons buttons); void titleReleased(Qt::MouseButton button, Qt::MouseButtons buttons); void titleMouseMoved(Qt::MouseButton button, Qt::MouseButtons buttons); + void closeWindow(); private slots: void themeChanged(); + void doCloseWindow(); private: QGraphicsView *m_view; diff --git a/useractions.cpp b/useractions.cpp index 817f4626e2..2aec51e4ce 100755 --- a/useractions.cpp +++ b/useractions.cpp @@ -701,7 +701,7 @@ void Workspace::performWindowOperation(Client* c, Options::WindowOperation op) c->performMouseCommand(Options::MouseUnrestrictedResize, cursorPos()); break; case Options::CloseOp: - c->closeWindow(); + QMetaObject::invokeMethod(c, "closeWindow", Qt::QueuedConnection); break; case Options::MaximizeOp: c->maximize(c->maximizeMode() == Client::MaximizeFull