[Thread Prev][Thread Next]   >Date Index >Thread Index

[wmx] small patch to fix a crash

Chris Cannam - Mon Aug 11 12:40:41 2003

I found a rather stupid bug in wmx-6: calling methods through a
pointer that's already been deleted.  We almost always got away
with it, but it just blew up on me this morning.

Client.C lines 112 onwards: if the client is active, the call to
windowManager()->setActiveClient(0) will call back to this client
to undecorate it, and that will cause a call through to the Border
object that was deleted at 112.  I have no idea why I deleted the
Border object there rather than in the destructor.  This patch
fixes that.


Chris
--- Client.C.~3~	Thu Oct  3 11:26:04 2002
+++ Client.C	Mon Aug 11 11:24:39 2003
@@ -75,7 +75,7 @@
 
 Client::~Client()
 {
-    // empty
+    delete m_border;
 }    
 
 
@@ -109,9 +109,6 @@
     if (isHidden()) unhide(False);
     windowManager()->removeFromOrderedList(this);
 
-    delete m_border;
-    m_window = None;
-
     if (isActive()) {
 	if (CONFIG_CLICK_TO_FOCUS) {
 	    if (m_revert) {
@@ -122,6 +119,8 @@
 	    windowManager()->setActiveClient(0);
 	}
     }
+
+    m_window = None;
 
     if (m_colormapWinCount > 0) {
 	XFree((char *)m_colormapWindows);

Next: