From a3357695a7f0d5ce714681921a69c9ab0ded2319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 11 Aug 2013 19:02:53 +0200 Subject: [PATCH] make stacking_order exclusive during shutdown Client::releaseClient() deletes all Client objects referenced by stacking_order, thus those pointers dangle and everything trying to touch it died an ugly death. REVIEW: 112020 BUG: 323383 --- workspace.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index 8237eeda9b..3ec6979500 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -420,8 +420,13 @@ Workspace::~Workspace() // TODO: grabXServer(); // Use stacking_order, so that kwin --replace keeps stacking order - for (ToplevelList::iterator it = stacking_order.begin(), end = stacking_order.end(); it != end; ++it) { - Client *c = qobject_cast(*it); + const ToplevelList stack = stacking_order; + // "mutex" the stackingorder, since anything trying to access it from now on will find + // many dangeling pointers and crash + stacking_order.clear(); + + for (ToplevelList::const_iterator it = stack.constBegin(), end = stack.constEnd(); it != end; ++it) { + Client *c = qobject_cast(const_cast(*it)); if (!c) { continue; }