Package: ctwm
Version: 3.7-3.2
Severity: important
Tags: upstream patch

Dear Maintainer,

I'm a longtime CTWM user who finally got tired of the random
crashes that occur, typically when I'm switching workspaces.
I can sometimes go for a month without seeing them and sometimes
it happens several times a day.  I've analyzed this to the point
where I can see that code in DispatchEvent() is occasionally
leaving the global Scr pointer NULL which causes a SIGSEGV on
our next pass through the loop in HandleEvents().

I've provided a patch that adds a few lines of defensive code
which seems to have improved the situation, though I have not
analyzed the root cause, which appears to be that, for unknown
reasons, either XFindContext() or FindScreenInfo() seem to be
unable to return the answer expected of them.

  --Michael O'Donnell

BEGIN PATCH:
--- events.c.b0rken     2012-03-06 15:10:42.093677349 -0500
+++ events.c    2012-03-06 15:19:52.369161662 -0500
@@ -435,21 +435,25 @@
  */
 Bool DispatchEvent2 (void)
 {
     Window w = Event.xany.window;
     StashEventTime (&Event);
+    ScreenInfo *lastScr = Scr;   /* XXX_MIKE - assume Scr OK on entry... */
 
     if (XFindContext (dpy, w, TwmContext, (XPointer *) &Tmp_win) == XCNOENT)
       Tmp_win = NULL;
 
     if (XFindContext (dpy, w, ScreenContext, (XPointer *)&Scr) == XCNOENT) {
        Scr = FindScreenInfo (WindowOfEvent (&Event));
     }
 
     dumpevent(&Event);
 
-    if (!Scr) return False;
+    if (!Scr) {
+        Scr = lastScr;           /* XXX_MIKE - try not to leave Scr NULL */
+        return False;
+    }
     if (Scr->Root != Scr->RealRoot) FixRootEvent (&Event);
 
 #ifdef SOUNDS
     play_sound(Event.type);
 #endif
@@ -473,21 +477,25 @@
  */
 Bool DispatchEvent (void)
 {
     Window w = Event.xany.window;
     StashEventTime (&Event);
+    ScreenInfo *lastScr = Scr;   /* XXX_MIKE - assume Scr OK on entry... */
 
     if (XFindContext (dpy, w, TwmContext, (XPointer *) &Tmp_win) == XCNOENT)
       Tmp_win = NULL;
 
     if (XFindContext (dpy, w, ScreenContext, (XPointer *)&Scr) == XCNOENT) {
        Scr = FindScreenInfo (WindowOfEvent (&Event));
     }
 
     dumpevent(&Event);
 
-    if (!Scr) return False;
+    if (!Scr) {
+        Scr = lastScr;           /* XXX_MIKE - try not to leave Scr NULL */
+        return False;
+    }
 
     if (captive) {
       if ((Event.type == ConfigureNotify) && (Event.xconfigure.window == 
Scr->CaptiveRoot)) {
        ConfigureRootWindow (&Event);
        return (False);

END PATCH

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 3.1.0 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages ctwm depends on:
ii  libc6       2.13-26
ii  libice6     2:1.0.7-2
ii  libjpeg8    8d-1
ii  librplay3   3.3.2-14
ii  libsm6      2:1.2.0-2
ii  libx11-6    2:1.4.4-4
ii  libxext6    2:1.3.0-3
ii  libxmu6     2:1.1.0-3
ii  libxpm4     1:3.5.9-4
ii  libxt6      1:1.1.1-2
ii  m4          1.4.16-2
ii  x11-common  1:7.6+11

ctwm recommends no packages.

ctwm suggests no packages.

-- Configuration Files:
/etc/X11/ctwm/system.ctwmrc [Errno 2] No such file or directory: 
u'/etc/X11/ctwm/system.ctwmrc'

-- no debconf information

-- debsums errors found:
debsums: missing file /usr/bin/ctwm (from ctwm package)

Note that the above mentioned debsums errors are due to my
having built and installed a private version during debug....
 



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to