bug-gnustep
[Top][All Lists]
Advanced

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

Fix, NSView (-releaseGState)


From: Georg Fleischmann
Subject: Fix, NSView (-releaseGState)
Date: Sat, 11 Sep 2010 18:24:51 +0800

Hi,

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;





#0  -[NSView releaseGState] (self=0x86f0250, _cmd=0xb7ea2990) at NSView.m:2187
#1  0xb7d1b700 in -[NSView dealloc] (self=0x86f0250, _cmd=0xb7a742f8)
    at NSView.m:737
#2  0xb78ffe01 in -[NSObject release] (self=0x86f0250, _cmd=0xb7ea27e0)
    at NSObject.m:1913
#3  0xb7d1c59c in -[NSView removeSubview:] (self=0x8785af8, _cmd=0xb7ea2a18,
    aView=0x86f0250) at NSView.m:945
#4  0xb7d1c251 in -[NSView removeFromSuperviewWithoutNeedingDisplay] (
    self=0x86f0250, _cmd=0xb7ea2970) at NSView.m:887
#5  0xb7d1b4a8 in -[NSView dealloc] (self=0x8785af8, _cmd=0xb7a742f8)
    at NSView.m:718
#6  0xb78ffe01 in -[NSObject release] (self=0x8785af8, _cmd=0xb7edf730)
    at NSObject.m:1913
#7  0xb7dce91b in -[GSWindowDecorationView removeSubview:] (self=0x8785a00,
    _cmd=0xb7ea2a18, aView=0x8785af8) at GSWindowDecorationView.m:218
#8  0xb7d1c251 in -[NSView removeFromSuperviewWithoutNeedingDisplay] (
    self=0x8785af8, _cmd=0xb7ea2970) at NSView.m:887
#9  0xb7d1b4a8 in -[NSView dealloc] (self=0x8785a00, _cmd=0xb7a742f8)
    at NSView.m:718
#10 0xb78ffe01 in -[NSObject release] (self=0x8785a00, _cmd=0xb7ea94c8)
    at NSObject.m:1913
#11 0xb7d2f19e in -[NSWindow dealloc] (self=0x87858f8, _cmd=0xb7a742f8)
    at NSWindow.m:788






reply via email to

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