From 6b67e50cbee9db2f15ed3b0f037a3d90aafdc1aa Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 13 Nov 2013 15:49:48 +0000 Subject: [PATCH] Bracket calls to timer callbacks with fl_lock_function()/fl_unlock_function() as occurs under WIN32 and X11. This was also missing in the FLTK 1.1 carbon version. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10019 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 8033120ca..7e72e3cf9 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -463,9 +463,7 @@ static void processFLTKEvent(void) { * break the current event loop */ static void breakMacEventLoop() -{ - fl_lock_function(); - +{ NSPoint pt={0,0}; NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined location:pt modifierFlags:0 @@ -473,7 +471,6 @@ static void breakMacEventLoop() windowNumber:0 context:NULL subtype:FLTKTimerEvent data1:0 data2:0]; [NSApp postEvent:event atStart:NO]; - fl_unlock_function(); } // @@ -521,6 +518,7 @@ static void delete_timer(MacTimeout& t) static void do_timer(CFRunLoopTimerRef timer, void* data) { + fl_lock_function(); current_timer = (MacTimeout*)data; current_timer->pending = 0; (current_timer->callback)(current_timer->data); @@ -529,6 +527,7 @@ static void do_timer(CFRunLoopTimerRef timer, void* data) current_timer = NULL; breakMacEventLoop(); + fl_unlock_function(); } void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void* data)