mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:01:16 +00:00
In -close, retain and release self to make sure it isn't deallocated too early.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14464 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1ea2a1d020
commit
98a06d10ca
2 changed files with 17 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-09-16 19:05 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
* Source/NSWindow.m (-close): Retain and release self to make sure
|
||||||
|
it isn't deallocated until we're done.
|
||||||
|
|
||||||
2002-09-15 Fred Kiefer <FredKiefer@gmx.de>
|
2002-09-15 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSStringDrawing.m
|
* Source/NSStringDrawing.m
|
||||||
|
|
|
@ -2100,6 +2100,17 @@ resetCursorRectsForView(NSView *theView)
|
||||||
{
|
{
|
||||||
if (_f.has_closed == NO)
|
if (_f.has_closed == NO)
|
||||||
{
|
{
|
||||||
|
/* The NSWindowCloseNotification might result in us being
|
||||||
|
deallocated. To make sure self stays valid as long as is
|
||||||
|
necessary, we retain ourselves here and balance it with a
|
||||||
|
release later (unless we're supposed to release ourselves when
|
||||||
|
we close).
|
||||||
|
*/
|
||||||
|
if (!_f.is_released_when_closed)
|
||||||
|
{
|
||||||
|
RETAIN(self);
|
||||||
|
}
|
||||||
|
|
||||||
CREATE_AUTORELEASE_POOL(pool);
|
CREATE_AUTORELEASE_POOL(pool);
|
||||||
|
|
||||||
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
||||||
|
@ -2114,10 +2125,7 @@ resetCursorRectsForView(NSView *theView)
|
||||||
RELEASE(pool);
|
RELEASE(pool);
|
||||||
|
|
||||||
_f.has_closed = YES;
|
_f.has_closed = YES;
|
||||||
if (_f.is_released_when_closed)
|
RELEASE(self);
|
||||||
{
|
|
||||||
RELEASE(self);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue