From kde-commits Wed May 27 07:13:43 2015 From: =?utf-8?q?Martin_Gr=C3=A4=C3=9Flin?= Date: Wed, 27 May 2015 07:13:43 +0000 To: kde-commits Subject: [kwin] /: Ensure Compositor can tear down without a Workspace Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=143271083805443 Git commit 48272a0de83fba3bddb1b38a91aee2fb926804d6 by Martin Gr=C3=A4=C3= =9Flin. 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 =3D 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_CO= MPOSITE_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(), XC= B_COMPOSITE_REDIRECT_MANUAL); + } delete effects; effects =3D NULL; delete m_scene; m_scene =3D NULL; compositeTimer.stop(); repaints_region =3D QRegion(); - for (ClientList::ConstIterator it =3D Workspace::self()->clientList().= constBegin(); - it !=3D Workspace::self()->clientList().constEnd(); - ++it) { - // forward all opacity values to the frame in case there'll be oth= er CM running - if ((*it)->opacity() !=3D 1.0) { - NETWinInfo i(connection(), (*it)->frameId(), rootWindow(), 0, = 0); - i.setOpacity(static_cast< unsigned long >((*it)->opacity() * 0= xffffffff)); + if (Workspace::self()) { + for (ClientList::ConstIterator it =3D Workspace::self()->clientLis= t().constBegin(); + it !=3D Workspace::self()->clientList().constEnd(); + ++it) { + // forward all opacity values to the frame in case there'll be= other CM running + if ((*it)->opacity() !=3D 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 =3D false; emit compositingToggled(false); }