mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 05:20:38 +00:00
Window retain/release fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6046 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
174b8c2cf1
commit
d144de1a07
2 changed files with 23 additions and 13 deletions
|
@ -833,6 +833,7 @@ static NSCell* tileCell = nil;
|
|||
|
||||
NSDebugLog(@"NSApplication -run\n");
|
||||
|
||||
pool = [arpClass new];
|
||||
/*
|
||||
* Set this flag here in case the application is actually terminated
|
||||
* inside -finishLaunching.
|
||||
|
@ -845,6 +846,7 @@ static NSCell* tileCell = nil;
|
|||
|
||||
[listener updateServicesMenu];
|
||||
[main_menu update];
|
||||
RELEASE(pool);
|
||||
while (app_should_quit == NO)
|
||||
{
|
||||
pool = [arpClass new];
|
||||
|
|
|
@ -117,6 +117,19 @@ BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
|
|||
|
||||
@implementation NSWindow
|
||||
|
||||
- (int) arc
|
||||
{
|
||||
return [self retainCount] - [NSAutoreleasePool autoreleaseCountForObject: self];
|
||||
}
|
||||
- (void) release
|
||||
{
|
||||
[super release];
|
||||
}
|
||||
- (id) retain
|
||||
{
|
||||
return [super retain];
|
||||
}
|
||||
|
||||
typedef struct NSView_struct
|
||||
{
|
||||
@defs(NSView)
|
||||
|
@ -214,6 +227,10 @@ static NSMapTable* windowmaps = NULL;
|
|||
NSGraphicsContext *context = GSCurrentContext();
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
[[NSRunLoop currentRunLoop]
|
||||
cancelPerformSelector: @selector(_handleWindowNeedsDisplay:)
|
||||
target: self
|
||||
argument: nil];
|
||||
|
||||
[self setFrameAutosaveName: nil];
|
||||
TEST_RELEASE(_wv);
|
||||
|
@ -1314,15 +1331,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
- (void) close
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
/*
|
||||
* If '_f.is_released_when_closed' then the window will be removed from the
|
||||
* global list of windows (causing it to be released) - so we must
|
||||
* bracket any work we do in a retain/release sequence in case that
|
||||
* removal takes place when we post the notification.
|
||||
*/
|
||||
if (_f.is_released_when_closed)
|
||||
RETAIN(self);
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
|
||||
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
||||
_f.has_opened = NO;
|
||||
|
@ -1333,6 +1342,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
[NSApp removeWindowsItem: self];
|
||||
[self orderOut: self];
|
||||
|
||||
RELEASE(arp);
|
||||
if (_f.is_released_when_closed)
|
||||
RELEASE(self);
|
||||
}
|
||||
|
@ -1499,9 +1509,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
{
|
||||
if ([aView isKindOfClass: viewClass])
|
||||
{
|
||||
if (_initial_first_responder)
|
||||
[_initial_first_responder autorelease];
|
||||
_initial_first_responder = [aView retain];
|
||||
ASSIGN(_initial_first_responder, aView);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2362,7 +2370,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
name = [name copy];
|
||||
[autosaveNames addObject: name];
|
||||
autosave_name = name;
|
||||
[name release];
|
||||
RELEASE(name);
|
||||
}
|
||||
else if (nameToRemove != nil)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue