Author: ianmacarthur
Date: 2011-04-17 07:39:16 -0700 (Sun, 17 Apr 2011)
New Revision: 8598
Log:
A quick hack to prevent the OSX tooltip-crash on
badly formed UTF8 strings.

This probably is not the best solution, but it
does work.
Note that the problem actually seems to be in
setting the window title, and indeed if you try to
label ANY window with a badly formed UTF8 string
(not just a tooltip) you get the same exception
thrown.

NOTE: I'm not even sure why we try to set the 
window title in tooltips, as it is never used 
and the tooltip label itlsef still works fine.

Anyway, we can do something better, but this will
work for now.

Aside: If you close an app on OSX whilst a tooltip
is visible, the app will not exit, as there is still
a window open (the tooltip) but no way to cancel
the tooltip.

Don't know if this is OSX specific or not though
but it is certainly a bug.



Modified:
   branches/branch-1.3/src/Fl_cocoa.mm

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-04-17 13:18:55 UTC (rev 8597)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-04-17 14:39:16 UTC (rev 8598)
@@ -1625,8 +1625,10 @@
 
 static void  q_set_window_title(NSWindow *nsw, const char * name ) {
   CFStringRef utf8_title = CFStringCreateWithCString(NULL, (name ? name : ""), 
kCFStringEncodingUTF8);
-       [nsw setTitle:(NSString*)utf8_title ];
-  CFRelease(utf8_title);
+  if(utf8_title) {
+    [nsw setTitle:(NSString*)utf8_title ];
+    CFRelease(utf8_title);
+  }
 }
 
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to