Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Plisson <damien.plisson@yahoo.fr>2009-10-05 19:00:07 +0400
committerDamien Plisson <damien.plisson@yahoo.fr>2009-10-05 19:00:07 +0400
commit77b8be6e1390f167bf83f0ca8b10f77fb758d4a0 (patch)
treeee5502ec503f2c1646673ebff455ddc9ec06bb14
parent3816554cbc1a40dc5199c8e56e45817ec09128d5 (diff)
Cocoa port : Fix bugs in clipboard operations
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm16
1 files changed, 12 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index c66153ab670..06ce2882beb 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1271,7 +1271,7 @@ GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const
NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
- if (pasteBoard = nil) {
+ if (pasteBoard == nil) {
[pool drain];
return NULL;
}
@@ -1289,11 +1289,19 @@ GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const
NSString * textPasted = [pasteBoard stringForType:@"public.utf8-plain-text"];
+ if (textPasted == nil) {
+ [pool drain];
+ return NULL;
+ }
+
pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (GHOST_TUns8*) malloc(pastedTextSize+1);
- if (temp_buff == NULL) return NULL;
+ if (temp_buff == NULL) {
+ [pool drain];
+ return NULL;
+ }
strncpy((char*)temp_buff, [textPasted UTF8String], pastedTextSize);
@@ -1318,12 +1326,12 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
- if (pasteBoard = nil) {
+ if (pasteBoard == nil) {
[pool drain];
return;
}
- NSArray *supportedTypes = [NSArray arrayWithObjects: @"public.utf8-plain-text",nil];
+ NSArray *supportedTypes = [NSArray arrayWithObject:@"public.utf8-plain-text"];
[pasteBoard declareTypes:supportedTypes owner:nil];