diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-09-11 19:45:25 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-09-11 19:45:25 +0000 |
commit | 4c0fe7ccc26630c18926f15bf017b6fcf191bf1b (patch) | |
tree | 94761ff5afed87fe6e9c846c9df694364779abdb /AppKit | |
parent | 42aa1c06dd802bfadc0f77f6b5a05f7f6fa2c067 (diff) |
[Author: dmaclach]
Fix up potential race condition returning launchedApps_.
R=thomasvl
DELTA=5 (2 added, 0 deleted, 3 changed)
Diffstat (limited to 'AppKit')
-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 |