mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Breakretain cycle of NSWindow and its context.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26494 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1988c2cef0
commit
ea97a86d9a
3 changed files with 29 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
|||
2008-05-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSWindow.m (-_terminateBackendWindow,
|
||||
-_initBackendWindow, -initWithWindowRef:): Break the retain cycle
|
||||
of the context keeping a reference to the window.
|
||||
* Source/NSCachedImageRep.m: Better checks for super calls
|
||||
returning nil.
|
||||
|
||||
2008-05-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSControl.m (-mouseDownFlags): Add old NeXT method, no
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
[self setExcludedFromWindowsMenu: YES];
|
||||
[self setAutodisplay: NO];
|
||||
[self setReleasedWhenClosed: NO];
|
||||
[self setMiniwindowImage: nil];
|
||||
}
|
||||
- (void) display
|
||||
{
|
||||
|
@ -91,6 +92,9 @@
|
|||
defer: NO];
|
||||
self = [self initWithWindow: win rect: frame];
|
||||
RELEASE(win);
|
||||
if (!self)
|
||||
return nil;
|
||||
|
||||
[self setAlpha: alpha];
|
||||
[self setBitsPerSample: NSBitsPerSampleFromDepth(aDepth)];
|
||||
|
||||
|
@ -104,7 +108,9 @@
|
|||
*/
|
||||
- (id) initWithWindow: (NSWindow *)aWindow rect: (NSRect)aRect
|
||||
{
|
||||
[super init];
|
||||
self = [super init];
|
||||
if (!self)
|
||||
return nil;
|
||||
|
||||
_window = RETAIN(aWindow);
|
||||
_rect = aRect;
|
||||
|
@ -115,11 +121,11 @@
|
|||
if (NSIsEmptyRect(_rect))
|
||||
{
|
||||
if (!_window)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Must specify either window or rect when "
|
||||
@"creating NSCachedImageRep"];
|
||||
}
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Must specify either window or rect when "
|
||||
@"creating NSCachedImageRep"];
|
||||
}
|
||||
|
||||
_rect = [_window frame];
|
||||
}
|
||||
|
@ -179,6 +185,9 @@
|
|||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
if (!self)
|
||||
return nil;
|
||||
|
||||
if ([aDecoder allowsKeyedCoding] == NO)
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_window];
|
||||
|
|
|
@ -721,6 +721,8 @@ many times.
|
|||
|
||||
if (_windowNum)
|
||||
{
|
||||
// The context will release the window, make up for that.
|
||||
RETAIN(self);
|
||||
DESTROY(_context);
|
||||
[_wv setWindowNumber: 0];
|
||||
[GSServerForWindow(self) termwindow: _windowNum];
|
||||
|
@ -819,6 +821,8 @@ many times.
|
|||
NSMapInsert(windowmaps, (void*)(intptr_t)_windowNum, self);
|
||||
|
||||
ASSIGN(_context, [NSGraphicsContext graphicsContextWithWindow: self]);
|
||||
// Now the context retains the window, release it once to make up
|
||||
RELEASE(self);
|
||||
|
||||
// Set window in new _gstate
|
||||
_gstate = GSDefineGState(_context);
|
||||
|
@ -1035,6 +1039,8 @@ many times.
|
|||
NSMapInsert (windowmaps, (void*)(intptr_t)_windowNum, self);
|
||||
|
||||
ASSIGN(_context, [NSGraphicsContext graphicsContextWithWindow: self]);
|
||||
// Now the context retains the window, release it once to make up
|
||||
RELEASE(self);
|
||||
|
||||
// Set window in new _gstate
|
||||
_gstate = GSDefineGState(_context);
|
||||
|
|
Loading…
Reference in a new issue