diff options
| author | Ian MacArthur <imacarthur@gmail.com> | 2011-04-17 14:39:16 +0000 |
|---|---|---|
| committer | Ian MacArthur <imacarthur@gmail.com> | 2011-04-17 14:39:16 +0000 |
| commit | d77223ea58b38c1fa7d4456d25fefa297fec9fd1 (patch) | |
| tree | d9c97a5c01d88aad4fe368ed1d88e16f3c534b70 /src | |
| parent | e67e6283179b05bc8a4feb5f3d4a544230bc5b57 (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 0951e1c06..120985a00 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -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); + } } |
