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

Garbage Collector Troubles

I would like to know more about exactly how LISP decides to gray out my
windows and how it goes about it.
I have been trying to track down this obscure bug for some time.  Here
is the situation:

I have an auto-offscreen-window class, that uses a view-draw-contents
:around method to force all drawing to an offscreen gworld, as opposed
to the screen, the idea being that

A) redrawing the window when the image isn't trashed is one copybits call.
B) All the drawing appears at once.

The class is written so as to be completely transparent, i.e., you could
take a finished window class, add auto-offscreen-window to its
inheritance list, and everything would work the way it should.

The problem happens when a gc occurs during drawing to the offscreen port.
And only then.
I have hacked up a cons-nk bytes function that does the obvious.  I use
it to creep right up to the gc-threshold.  Invoking gc manually does not
lead to a crash.  When I do something that cause the window to redraw,
however, the thing crashes horribly inside of the gc call (Illegal
instruction usually - sometimes it crashes on something called "Not

For you skeptics out there:

1) My program works fine with heap scrambling on (besides crashing
during a gc).
2) I am not drawing outside of the bounds of the gworld - I override the
clip-rect and set-clip-region methods to always intersect the
clip-region the client wants with the bounds of the offscreen gworld so
he can't accidentally screw himself. (I don't even know if this is
necessary, but it is just another one of the precautions I took in
trying to find this bug).
3) The program has run for a full 5 hour session, gc's included, only I
have to invoke them myself from the listener to prevent a crash.

I override all of the drawing methods (i.e., frame-rect, line-to, etc.)
to accomplish the transparency.  These methods set the port according to
whether you are drawing offscreen.

The point -> How is the feature that grays out the windows with pending
updates implemented?  Right now my feeling is that LISP's operations on
my window are causing some bad interaction, since the bug NEVER occurs
at any other time.

Any help would be appreciated, and if the tone of this message is angry,
I'm sorry, I've been looking for this bug for a long time.