fix crash from removeClient if window wasn't the active client
rathnor rathnor
2 files changed,
17 insertions(+),
7 deletions(-)
M
ChangeLog
→
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)
M
src/Window.cc
→
src/Window.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ #ifdef DEBUG
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());