diff --git a/client.cpp b/client.cpp index 1f2a96b065..19710b2e5f 100644 --- a/client.cpp +++ b/client.cpp @@ -978,6 +978,8 @@ bool Client::unmapNotify( XUnmapEvent& e ) void Client::withdraw() { Events::raise( isTransient() ? Events::TransDelete : Events::Delete ); + // remove early from client list + workspace()->removeClient( this ); setMappingState( WithdrawnState ); info->setDesktop( 0 ); desk = 0; diff --git a/workspace.cpp b/workspace.cpp index 9dd858d6c2..f7ec23138b 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -627,6 +627,14 @@ QRect Workspace::geometry() const } } + +void Workspace::removeClient( Client* c) { + clients.remove( c ); + stacking_order.remove( c ); + focus_chain.remove( c ); + propagateClients(); +} + /* Destroys the client \a c */ @@ -634,9 +642,10 @@ bool Workspace::destroyClient( Client* c) { if ( !c ) return FALSE; - clients.remove( c ); - stacking_order.remove( c ); - focus_chain.remove( c ); + + if (clients.contains(c)) + removeClient(c); + c->invalidateWindow(); clientHidden( c ); if ( c == desktop_client ) @@ -651,7 +660,6 @@ bool Workspace::destroyClient( Client* c) last_active_client = 0; storeFakeSessionInfo( c ); delete c; - propagateClients(); updateClientArea(); return TRUE; } diff --git a/workspace.h b/workspace.h index afc1dcee31..0b6ace35a4 100644 --- a/workspace.h +++ b/workspace.h @@ -102,6 +102,8 @@ public: QRect clientArea(); + void removeClient( Client* ); + bool destroyClient( Client* ); void killWindowAtPosition(int x, int y);