Skip to content
Snippets Groups Projects
Commit 15289f57 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix leak in copy to clipboard

parent ccce123c
No related branches found
No related tags found
No related merge requests found
...@@ -64,13 +64,14 @@ void setupCocoa() ...@@ -64,13 +64,14 @@ void setupCocoa()
bool copyToPBoard(const unsigned short *str, unsigned int len) bool copyToPBoard(const unsigned short *str, unsigned int len)
{ {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; @autoreleasepool {
NSPasteboard *pboard = [NSPasteboard generalPasteboard]; NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard clearContents]; [pboard clearContents];
NSArray *contentsToPaste = [[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil]; NSArray *contentsToPaste = [[[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil] autorelease];
[pool release]; BOOL ret = [pboard writeObjects:contentsToPaste];
return [pboard writeObjects:contentsToPaste]; return ret;
}
} }
bool pasteBoardAvailable() bool pasteBoardAvailable()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment