summaryrefslogtreecommitdiff
path: root/macosx/RecentItemsMenu.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-09 01:50:38 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-09 01:50:38 +0000
commit9af085242bda9ad4da78ef23e9d4ed180aa2c629 (patch)
treec776a5dfefbe475936a461b54d469d244df9de75 /macosx/RecentItemsMenu.m
parentc5b4bf6974fbfd05b6e75c494d11569756034e36 (diff)
downloadpcsxr-9af085242bda9ad4da78ef23e9d4ed180aa2c629.tar.gz
Use ARC in 64-bit mode on the Mac.
Register when we drag a disc image (or double click) to Pcsxr in the recent menu. Comment out ReleasePlugins() in SysClose: it was causing a pointer to be released twice when you changed a plug-in (specifically, the GPU). Cleaning up the Recent items code. One notable case is only releasing objects we have ownership of (this is pointless in ARC, but necessary in 32-bit code). Had to rewrite -[PluginList setActivePlugin:forType:] because the previous version wasn't ARC-friendly. If we select a disc while the emulator is running, load the disc into the current session. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82136 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/RecentItemsMenu.m')
-rwxr-xr-xmacosx/RecentItemsMenu.m18
1 files changed, 11 insertions, 7 deletions
diff --git a/macosx/RecentItemsMenu.m b/macosx/RecentItemsMenu.m
index aaf3f01b..a3ffa8ee 100755
--- a/macosx/RecentItemsMenu.m
+++ b/macosx/RecentItemsMenu.m
@@ -7,6 +7,7 @@
//
#import "RecentItemsMenu.h"
+#import "ARCBridge.h"
@implementation RecentItemsMenu
@@ -19,7 +20,9 @@
NSArray* recentDocuments = [[NSDocumentController sharedDocumentController] recentDocumentURLs];
NSInteger index = 0;
for(NSURL* url in recentDocuments) {
- [self addMenuItem:[self createMenuItem:url] atIndex:index];
+ NSMenuItem *tempItem = [self createMenuItem:url];
+ [self addMenuItem:tempItem atIndex:index];
+ RELEASEOBJ(tempItem);
index++;
}
}
@@ -28,13 +31,16 @@
{
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:documentURL];
- NSMenuItem* item = [self findMenuItemByURL:documentURL];
+ NSMenuItem* item = RETAINOBJ([self findMenuItemByURL:documentURL]);
if(item != nil) {
[self removeItem:item];
[self insertItem:item atIndex:0];
+ RELEASEOBJ(item);
}
else {
- [self addMenuItem:[self createMenuItem:documentURL]];
+ NSMenuItem *newitem = [self createMenuItem:documentURL];
+ [self addMenuItem:newitem];
+ RELEASEOBJ(newitem);
}
}
@@ -63,16 +69,14 @@
- (void)addMenuItem:(NSMenuItem*)item atIndex:(NSInteger)index
{
[self insertItem:item atIndex:index]; // insert at the top
- [item release];
}
- (NSMenuItem*)createMenuItem:(NSURL*)documentURL
{
- NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[documentURL relativePath] action:@selector(openRecentItem:) keyEquivalent:@""];
+ NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[documentURL lastPathComponent] action:@selector(openRecentItem:) keyEquivalent:@""];
[newItem setRepresentedObject:documentURL];
- [newItem setEnabled:YES];
+ //[newItem setEnabled:YES];
[newItem setTarget:self];
- [newItem setTag:0];
return newItem;
}