diff options
| author | Fabien Costantini <fabien@onepost.net> | 2009-01-27 13:38:23 +0000 |
|---|---|---|
| committer | Fabien Costantini <fabien@onepost.net> | 2009-01-27 13:38:23 +0000 |
| commit | b4a3ce9d0878b69d25afc0028e762084c25ac8c6 (patch) | |
| tree | 5192acad308c0fe929310e93c802c65c56d8af48 /src | |
| parent | 2d883b17707b4e101efd126a11b1a8b651a4c500 (diff) | |
STR#2133 fix: erroneously releasing flavorType would cause a crash when pasting twice in an Fl_Input object.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6646 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_mac.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index dc35f3f93..f17e79cb7 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -2597,7 +2597,7 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { if (err!=noErr) continue; err = PasteboardCopyItemFlavors(myPasteboard, itemID, &flavorTypeArray); if (err!=noErr) { - if (flavorTypeArray) {CFRelease (flavorTypeArray); flavorTypeArray = NULL;} + if (flavorTypeArray) {CFRelease(flavorTypeArray); flavorTypeArray = NULL;} continue; } CFIndex flavorCount = CFArrayGetCount(flavorTypeArray); @@ -2609,20 +2609,18 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { if(err != noErr) continue; encoding = encodings[j]; found = true; - if (flavorType) CFRelease(flavorType); break; } - if (flavorType) {CFRelease(flavorType); flavorType = NULL;} } if(found) break; } - if (flavorTypeArray) {CFRelease (flavorTypeArray); flavorTypeArray = NULL;} + if (flavorTypeArray) {CFRelease(flavorTypeArray); flavorTypeArray = NULL;} if (found) break; } if(found) { CFIndex len = CFDataGetLength(flavorData); CFStringRef mycfs = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(flavorData), len, encoding, false); - CFRelease (flavorData); + CFRelease(flavorData); len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(mycfs), kCFStringEncodingUTF8) + 1; if ( len >= fl_selection_buffer_length[1] ) { fl_selection_buffer_length[1] = len; @@ -2630,7 +2628,7 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { fl_selection_buffer[1] = new char[len]; } CFStringGetCString(mycfs, fl_selection_buffer[1], len, kCFStringEncodingUTF8); - CFRelease (mycfs); + CFRelease(mycfs); len = strlen(fl_selection_buffer[1]); fl_selection_length[1] = len; convert_crlf(fl_selection_buffer[1],len); // turn all \r characters into \n: |
