diff options
-rw-r--r-- | AppKit/GTMNSWorkspace+Running.m | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/AppKit/GTMNSWorkspace+Running.m b/AppKit/GTMNSWorkspace+Running.m index 82c2fa5..ef3cc2f 100644 --- a/AppKit/GTMNSWorkspace+Running.m +++ b/AppKit/GTMNSWorkspace+Running.m @@ -220,6 +220,7 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMWorkspaceRunningApplicationList, } - (NSArray *)launchedApplications { + NSArray *localReturn = nil; @synchronized (self) { if (!launchedApps_) { NSWorkspace *ws = [NSWorkspace sharedWorkspace]; @@ -245,10 +246,11 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMWorkspaceRunningApplicationList, } launchedApps_ = [launchedApps retain]; } + localReturn = launchedApps_; // We want to keep launchedApps_ in the autoreleasepool of this thread - [[launchedApps_ retain] autorelease]; + [[localReturn retain] autorelease]; } - return launchedApps_; + return localReturn; } @end |