Re: [Sawfish] periodic segfault

[ Thread Index | Date Index | More Archives ]

Hi. This looks very annoying. How can it happen?
Let's see the function. It's simple.

refresh_frame_part (struct frame_part *fp)
    if (!frame_draw_mutex)
	Lisp_Window *w = fp->win;
	if (w == 0)			/* XXX why is this needed? */

	if (fp->drawn.width != fp->width || fp->drawn.height != fp->height)
	    fp-> = rep_NULL;

	if (!WINDOW_IS_GONE_P (w) && fp->id != 0) /* It happened  here */
	    set_frame_part_bg (fp);
	if (!WINDOW_IS_GONE_P (w) && fp->id != 0)
	    set_frame_part_fg (fp);

	fp->drawn.width = fp->width;
	fp->drawn.height = fp->height;
	fp->pending_refresh = 0;
	fp->pending_refresh = 1;

In X, each frame components (top, bottom, buttons, etc) are drawed in
a separate window, and there exists a window which contains all of the
client (= application) window and the frame components. (Such kind of
window managers are called "reparenting WMs".) refresh_frame_part() is
a function to redraw a frame part (= a frame component).

fp->win is the window associated with the concerned frame part,
represented as a librep lisp object. ** And the check follows if it's
not NULL. **

It seems WINDOW_IS_GONE_P segfaults, but it's defined in sawfish.h as:
  #define WINDOW_IS_GONE_P(w) (w->id == 0)

But w is not NULL! I'm lost here.

Hmm. Will it help to replace
(w == 0) with
(w == 0 || ! WINDOWP(w)) ?

But this is simply sweeping the true bug under the carpet, and it
may lead to a worse situation.

Teika (Teika kazura)

Sawfish ML

Mail converted by MHonArc 2.6.19+