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

[wmx] The patch to fix mysterious crashes and disappearing fonts in root menus

Lasse Rasinen - Sat May 15 00:19:54 1999

The problem appears to be the borderCounter variable, which keeps track of
borders on screen. Apparently this gets screwed up if there's a window
before wmx gets started, or something. Anyway, after the code frees it,
it's never reallocated. 

Fix: Don't free it and abolish the borderCounter variable, while we're at
it.

Note: Now that we don't free m_drawGC anymore, there's a tiny memory leak.
But, since X is (in 999999 cases out of 1000000) going to die in a few
seconds, I don't think this is a problem. Furthermore, none of the other
statics allocated in Border::initialiseStatics are freed.

This is tested to the extent that it appears to work, caveat emptor.


--- Border.C.old Sat May 15 01:09:10 1999
+++ Border.C    Sat May 15 01:10:27 1999
@@ -23,9 +23,6 @@
 unsigned long Border::m_borderPixel;
 Pixmap Border::m_backgroundPixmap = None;
 
-static int borderCounter = 0;
-
-
 class BorderRectangle // must resemble XRectangle in storage
 {
 public:
@@ -70,7 +67,6 @@
 {
     m_parent = root();
     if (m_tabFont == 0) initialiseStatics(c->windowManager());
-    ++borderCounter;
 
 //#if CONFIG_MAD_FEEDBACK != 0
     m_feedback = 0;
@@ -94,13 +90,6 @@
     }
 
     if (m_label) free(m_label);
-
-    if (--borderCounter == 0) {
-     XFreeGC(display(), m_drawGC);
-     if (m_backgroundPixmap != None) {
-         XFreePixmap(display(), m_backgroundPixmap);
-     }
-    }
 }
 
 


Next: