Hallo Fred,

I just testes GNUstep GUI from yesterday with Cenon, and now all graphic 
windows are pitch black, no contents at all.

> _allocate_gstate will change its value when the view moves to another
> window. Application code will have to set this again.

If I remove the [self releaseGState] in [NSView _viewWillMoveToWindow:], it 
works again.
It also works if I just keep the _allocate_gstate alive.

As the Cenon graphics code runs perfectly on OpenStep 4.2 and Apple, I would 
say, the _allocate_gstate flag should be transferred with the view to the new 
window.

Best wishes,
Georg


On 15.09.2010, at 16:22, Fred Kiefer wrote:

> 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;
> 


_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to