From 264c73c9ab0f6083a7f76480e0783e55cc1e5cd1 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 11 Jul 2011 13:52:16 +0000 Subject: [PATCH] Mac OS: added missing lock/unlock pairs when running system menu items. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8851 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 1b0130fac..02a40569b 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2881,6 +2881,7 @@ void Fl_X::set_cursor(Fl_Cursor c) if(!win) return; if( printer.start_job(1) ) return; if( printer.start_page() ) return; + fl_lock_function(); // scale the printer device so that the window fits on the page float scale = 1; printer.printable_rect(&w, &h); @@ -2903,6 +2904,7 @@ void Fl_X::set_cursor(Fl_Cursor c) #endif printer.end_page(); printer.end_job(); + fl_unlock_function(); } @end @@ -2991,6 +2993,7 @@ static void createAppleMenu(void) @implementation FLMenuItem - (void) doCallback:(id)unused { + fl_lock_function(); int flRank = [self tag]; const Fl_Menu_Item *items = fl_sys_menu_bar->Fl_Menu_::menu(); const Fl_Menu_Item *item = items + flRank; @@ -3019,11 +3022,14 @@ static void createAppleMenu(void) } } } + fl_unlock_function(); } - (void) directCallback:(id)unused { + fl_lock_function(); Fl_Menu_Item *item = (Fl_Menu_Item *)[(NSData*)[self representedObject] bytes]; if ( item && item->callback() ) item->do_callback(NULL); + fl_unlock_function(); } @end @@ -3417,7 +3423,6 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset) this->print_widget(win, x_offset, y_offset); return; } - fl_lock_function(); // necessary because of call to Fl::check() below. int bx, by, bt; get_window_frame_sizes(bx, by, bt); Fl_Display_Device::display_device()->set_current(); // send win to front and make it current @@ -3444,7 +3449,6 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset) } } this->print_widget(win, x_offset, y_offset + bt); // print the window inner part - fl_unlock_function(); } #include