Any info about the suggestion previously made to use the
Fl::delete_widget(Fl_Widget*) function ?

Another suggestion would be to replace
  [[i->xid contentView]  lockFocus];
by
  if ( ! [[i->xid contentView] lockFocusIfCanDraw] ) return;


> Hello,
>
> I have been using FLTK for quite a while now (about a year), and with some 
> success. I use the 1.3.2 version, which I have integrated in projects on 
> Windows, Mac OS and Linux.
>
> However, I have a real problem on Mac OS, a crash which happens in certain 
> cases when I mix a (non FLTK) modal window and an FLTK window. When I destroy 
> the FLTK window, I have a crash...
>
> I traced the error back to Fl::make_current in Fl_cocoa.mm, with a lockFocus, 
> which is where the bug is perpetrated...
>
> For the moment, the only way for me to bypass this problem is to add a 
> @try/@catch around the lockFocus and I destroy the window...
>
> void Fl_Window::make_current() {
> ...
>     NSView *current_focus = [NSView focusView];
>     // sometimes current_focus is set to a non-FLTK view: don't touch that
>     @try {
>         if ( [current_focus isKindOfClass:[FLView class]] )
>             [current_focus unlockFocus];
>         [[i->xid contentView]  lockFocus]; <-- CRASH HERE
>     }
>     @catch(NSException* e) {
>         delete this;  <-- VERY HORRIBLE, but it does not seem to matter
>         return;
>     }
>
>
> It works, but I do not feel very comfortable to modify the code of a library 
> which I use on many platform.
>
> Do you have any idea how I could bypass this error in a more acceptable way?
>
> Thank you in advance...
>

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

Reply via email to