OsX[AppleEvents]: try to avoid some crash by delaying the function which is called
by such events... Fixes #292
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
#include "tools/prefs.hpp"
|
||||
#include "tools/framerate_limiter.hpp"
|
||||
|
||||
#ifdef __APPLE__
|
||||
short menuChoiceId=-1;
|
||||
#endif
|
||||
|
||||
cUniverse univ;
|
||||
|
||||
rectangle pc_area_buttons[6][4] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later
|
||||
@@ -168,6 +172,12 @@ void handle_events() {
|
||||
cFramerateLimiter fps_limiter;
|
||||
|
||||
while(!All_Done) {
|
||||
#ifdef __APPLE__
|
||||
if (menuChoiceId>=0) {
|
||||
handle_menu_choice(eMenu(menuChoiceId));
|
||||
menuChoiceId=-1;
|
||||
}
|
||||
#endif
|
||||
while(mainPtr.pollEvent(currentEvent)) handle_one_event(currentEvent);
|
||||
|
||||
redraw_everything();
|
||||
|
@@ -15,6 +15,8 @@
|
||||
#error pc.menus.mm is Mac-specific code; try compiling pc.menus.win.cpp instead
|
||||
#endif
|
||||
|
||||
extern short menuChoiceId;
|
||||
|
||||
using MenuHandle = NSMenu*;
|
||||
|
||||
extern cUniverse univ;
|
||||
@@ -102,7 +104,8 @@ void drawMenuBar() {
|
||||
|
||||
@implementation MenuHandler
|
||||
-(void) menuChoice:(id) sender {
|
||||
eMenu opt = eMenu([[sender representedObject] intValue]);
|
||||
handle_menu_choice(opt);
|
||||
menuChoiceId=short([[sender representedObject] intValue]);
|
||||
//eMenu opt = eMenu([[sender representedObject] intValue]);
|
||||
//handle_menu_choice(opt);
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user