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()
bool copyToPBoard(const unsigned short *str, unsigned int len)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard clearContents];
NSArray *contentsToPaste = [[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil];
[pool release];
return [pboard writeObjects:contentsToPaste];
@autoreleasepool {
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard clearContents];
NSArray *contentsToPaste = [[[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil] autorelease];
BOOL ret = [pboard writeObjects:contentsToPaste];
return ret;
}
}
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