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.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8598 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Ian MacArthur
2011-04-17 14:39:16 +00:00
parent e67e628317
commit d77223ea58
+4 -2
View File
@@ -1625,8 +1625,10 @@ Fl_Window *fl_dnd_target_window = 0;
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);
}
}