From b7e9f1eb770321a50df266631694b0ac2259daf9 Mon Sep 17 00:00:00 2001 From: Fabien Costantini Date: Fri, 16 Jan 2009 14:39:41 +0000 Subject: STR#2121: added a break in the flavortypes main loop just in case one day we have more than one to choose from so that the order of the one choosed is guaranteed, also fixed potential memory leaks by releasing flavorTypeArray when exiting the main loop prematurely. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6635 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_mac.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 7652de5e0..7c4689250 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -2499,7 +2499,7 @@ void Fl_X::q_end_image() { // Copy & Paste fltk implementation. //////////////////////////////////////////////////////////////// -// fltk 1.3 clipboard constant support definitions: +// fltk 1.3 clipboard support constant definitions: const CFStringRef flavorNames[] = { CFSTR("public.utf16-plain-text"), CFSTR("public.utf8-plain-text"), @@ -2597,9 +2597,12 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { err = PasteboardGetItemIdentifier(myPasteboard, i, &itemID); if (err!=noErr) continue; err = PasteboardCopyItemFlavors(myPasteboard, itemID, &flavorTypeArray); - if (err!=noErr) continue; + if (err!=noErr) { + if (flavorTypeArray) {CFRelease (flavorTypeArray); flavorTypeArray = NULL;} + continue; + } flavorCount = CFArrayGetCount(flavorTypeArray); - for(j = 0; j < handledFlavorsCount; j++) { + for (j = 0; j < handledFlavorsCount; j++) { for (CFIndex flavorIndex=0; flavorIndex