Again thank you for your answers. I did not expect to receive so fast a response, which is in par with the quality of your tools.
However, I have eventually discovered what was wrong. When I load a FLTK window, then a window of my own (within my COCOA application), then again a FLTK window, then the deletion of a FLTK window does not go through windowShouldClose anymore, but only through anyWindowWillClose, hence the lockFocus error later on. The reason is that the FLTK NSApp delegate is a little bit stirred by the external call of another type of window, so I guess. The solution I came up with is to reinitialize the place where the setDelegate is done the very first time. I have implemented a fltk_reinit function, which I call before launching a Fl::run... //The pool is now in an external variable... static NSAutoreleasePool *localPool=nil; //The same for beenHereDoneThat, no longer a static within fl_open_display static char beenHereDoneThat = 0; void fltk_reinit() { //We clean everything back if (beenHereDoneThat==1) [localPool release]; //then the next call to fl_open_display will reinitialize everything. beenHereDoneThat=0; } void fl_open_display() { if ( !beenHereDoneThat ) { beenHereDoneThat = 1; BOOL need_new_nsapp = (NSApp == nil); if (need_new_nsapp) [NSApplication sharedApplication]; localPool = [[NSAutoreleasePool alloc] init]; // never released ... It seems to do the trick... _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk