Hi Georg,

thank you for this patch. It surely is correct and I will add it. But as
you already pointed out there may be a deeper problem here.
I think that we should always clean up the gstate when the window for a
view changes, that is in the method _viewWillMoveToWindow:. Something like:

if (_gstate)
  if (_window)
    GSUndefineGState([_window graphicsContext], _gstate);
  _gstate = 0;

Do you or anybody else on this list, see any problem with that change?

Fred


Am 11.09.2010 12:24, schrieb Georg Fleischmann:
> here is a small patch for NSView (SVN 2010-09-10 and before) to prevent a 
> crash in Cenon when closing a Graphic Window.
> The same code of Cenon works on Apple, so I suspect it's an issue with 
> GNUstep.
> 
> The crash is in NSView, which has a gstate but no _window (_window = nil) to 
> get the graphicsContext. This is causing the crash.
> I simply tested for a _window != nil to prevent the crash, and everything 
> appears to work.
> 
> There might be an issue with the order of releasing the hierarchy of windows 
> and views or something in that line, creating the situation in the first 
> place, but I'm not deep enough into that to have any idea.
> I also add the stack of the situation.
> 
> Best wishes,
> Georg Fleischmann
> 
> 
> 
> *** Source/NSView.m.old       2010-09-04 13:30:30.000000000 +0800
> --- Source/NSView.m   2010-09-11 17:45:22.000000000 +0800
> ***************
> *** 2183,2189 ****
>   */
>   - (void) releaseGState
>   {
> !   if (_allocate_gstate && _gstate)
>       GSUndefineGState([_window graphicsContext], _gstate);
>     _gstate = 0;
>     _allocate_gstate = NO;
> --- 2183,2189 ----
>   */
>   - (void) releaseGState
>   {
> !   if (_allocate_gstate && _gstate && _window)
>       GSUndefineGState([_window graphicsContext], _gstate);
>     _gstate = 0;
>     _allocate_gstate = NO;


_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to