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: Wed, 15 Sep 2010 10:22:29 +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

Should be in SVN now. As the logic of undefining a gstate is now a bit
more complicated I rather call this method from _viewWillMoveToWindow:
instead of duplicating the code. This has the drawback that
_allocate_gstate will change its value when the view moves to another
window. Application code will have to set this again.

Fred

Am 13.09.2010 10:05, schrieb Georg Fleischmann:
> Hi Fred,
> 
>> if (_gstate)
>>  if (_window)
>>    GSUndefineGState([_window graphicsContext], _gstate);
>>  _gstate = 0;
> 
> I added this at the beginning of _viewWillMoveToWindow: and played with some 
> graphic windows in Cenon.
> It will crash, if there is a _gstate but _window has no graphicsContext, 
> which seems to be possible here.
> If I add an additional test for [_window graphicsContext != nil, then I don't 
> get any problems.
> 
> Georg
> 
> 
> On 11.09.2010, at 20:17, Fred Kiefer wrote:
> 
>> 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]