[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin] /: Ensure Compositor can tear down without a Workspace
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2015-05-27 7:13:43
Message-ID: E1YxVX5-0007ll-A3 () scm ! kde ! org
[Download RAW message or body]

Git commit 48272a0de83fba3bddb1b38a91aee2fb926804d6 by Martin Gräßlin.
Committed on 27/05/2015 at 07:13.
Pushed by graesslin into branch 'master'.

Ensure Compositor can tear down without a Workspace

It's possible that the Workspace doesn't get created at all (e.g.
Xwayland failed to start). In that case we must ensure to not call into
Workspace calls during tear down.

M  +31   -27   composite.cpp

http://commits.kde.org/kwin/48272a0de83fba3bddb1b38a91aee2fb926804d6

diff --git a/composite.cpp b/composite.cpp
index b3b6a64..742db06 100644
--- a/composite.cpp
+++ b/composite.cpp
@@ -362,41 +362,45 @@ void Compositor::finish()
         return;
     m_finishing = true;
     m_releaseSelectionTimer.start();
-    foreach (Client * c, Workspace::self()->clientList())
-        m_scene->windowClosed(c, NULL);
-    foreach (Client * c, Workspace::self()->desktopList())
-        m_scene->windowClosed(c, NULL);
-    foreach (Unmanaged * c, Workspace::self()->unmanagedList())
-        m_scene->windowClosed(c, NULL);
-    foreach (Deleted * c, Workspace::self()->deletedList())
-        m_scene->windowDeleted(c);
-    foreach (Client * c, Workspace::self()->clientList())
-    c->finishCompositing();
-    foreach (Client * c, Workspace::self()->desktopList())
-    c->finishCompositing();
-    foreach (Unmanaged * c, Workspace::self()->unmanagedList())
-    c->finishCompositing();
-    foreach (Deleted * c, Workspace::self()->deletedList())
-    c->finishCompositing();
-    xcb_composite_unredirect_subwindows(connection(), rootWindow(), XCB_COMPOSITE_REDIRECT_MANUAL);
+    if (Workspace::self()) {
+        foreach (Client * c, Workspace::self()->clientList())
+            m_scene->windowClosed(c, NULL);
+        foreach (Client * c, Workspace::self()->desktopList())
+            m_scene->windowClosed(c, NULL);
+        foreach (Unmanaged * c, Workspace::self()->unmanagedList())
+            m_scene->windowClosed(c, NULL);
+        foreach (Deleted * c, Workspace::self()->deletedList())
+            m_scene->windowDeleted(c);
+        foreach (Client * c, Workspace::self()->clientList())
+        c->finishCompositing();
+        foreach (Client * c, Workspace::self()->desktopList())
+        c->finishCompositing();
+        foreach (Unmanaged * c, Workspace::self()->unmanagedList())
+        c->finishCompositing();
+        foreach (Deleted * c, Workspace::self()->deletedList())
+        c->finishCompositing();
+        xcb_composite_unredirect_subwindows(connection(), rootWindow(), XCB_COMPOSITE_REDIRECT_MANUAL);
+    }
     delete effects;
     effects = NULL;
     delete m_scene;
     m_scene = NULL;
     compositeTimer.stop();
     repaints_region = QRegion();
-    for (ClientList::ConstIterator it = Workspace::self()->clientList().constBegin();
-            it != Workspace::self()->clientList().constEnd();
-            ++it) {
-        // forward all opacity values to the frame in case there'll be other CM running
-        if ((*it)->opacity() != 1.0) {
-            NETWinInfo i(connection(), (*it)->frameId(), rootWindow(), 0, 0);
-            i.setOpacity(static_cast< unsigned long >((*it)->opacity() * 0xffffffff));
+    if (Workspace::self()) {
+        for (ClientList::ConstIterator it = Workspace::self()->clientList().constBegin();
+                it != Workspace::self()->clientList().constEnd();
+                ++it) {
+            // forward all opacity values to the frame in case there'll be other CM running
+            if ((*it)->opacity() != 1.0) {
+                NETWinInfo i(connection(), (*it)->frameId(), rootWindow(), 0, 0);
+                i.setOpacity(static_cast< unsigned long >((*it)->opacity() * 0xffffffff));
+            }
         }
+        // discard all Deleted windows (#152914)
+        while (!Workspace::self()->deletedList().isEmpty())
+            Workspace::self()->deletedList().first()->discard();
     }
-    // discard all Deleted windows (#152914)
-    while (!Workspace::self()->deletedList().isEmpty())
-        Workspace::self()->deletedList().first()->discard();
     m_finishing = false;
     emit compositingToggled(false);
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic