From e7a5539b29e23bb0b686b4a06bf1e8cc3133c95c Mon Sep 17 00:00:00 2001 From: rathnor <rathnor> Date: Wed, 7 May 2003 16:44:51 +0000 Subject: fix crash from removeClient if window wasn't the active client --- ChangeLog | 2 ++ src/Window.cc | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 238d529..c35cd7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.2: *03/05/07: + * Fix crash when detaching client that isn't active (Simon) + Window.cc * Fixed transient grouping issues (transients now WinClients) (Simon) WinClient.hh/cc Window.hh/cc Workspace.cc Screen.cc * Fixed screen problem with redrawing menus (Henrik) diff --git a/src/Window.cc b/src/Window.cc index dfcc7a9..967f943 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.160 2003/05/07 16:21:26 rathnor Exp $ +// $Id: Window.cc,v 1.161 2003/05/07 16:44:51 rathnor Exp $ #include "Window.hh" @@ -631,18 +631,26 @@ bool FluxboxWindow::removeClient(WinClient &client) { cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"]"<<endl; #endif // DEBUG + // if it is our active client, deal with it... + if (m_client == &client) { // set next client to be focused // if the client we're about to remove is the last client then set prev client - if (&client == m_clientlist.back()) - prevClient(); - else - nextClient(); + if (&client == m_clientlist.back()) + prevClient(); + else + nextClient(); + } client.m_win = 0; m_clientlist.remove(&client); - if (m_client == &client && m_clientlist.empty()) - m_client = 0; + if (m_client == &client) { + if (m_clientlist.empty()) + m_client = 0; + else + // this really shouldn't happen + m_client = m_clientlist.back(); + } FbTk::EventManager &evm = *FbTk::EventManager::instance(); evm.remove(client.window()); -- cgit v0.11.2