bug-gnustep
[Top][All Lists]
Advanced

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

Re: Fix, NSView (-releaseGState)


From: Fred Kiefer
Subject: Re: Fix, NSView (-releaseGState)
Date: Sat, 11 Sep 2010 14:17:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6

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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]