editors, OSX and menu[hack]: try to avoid crashes by postponing the creation of dialogs in the main loop.
This commit is contained in:
@@ -30,6 +30,10 @@
|
||||
#include "event_listener.hpp"
|
||||
#include "drawable_manager.hpp"
|
||||
|
||||
#ifdef __APPLE__
|
||||
short menuChoiceId=-1;
|
||||
#endif
|
||||
|
||||
/* Globals */
|
||||
bool All_Done = false;
|
||||
sf::RenderWindow mainPtr;
|
||||
@@ -227,6 +231,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);
|
||||
|
||||
// Why do we have to set this to false after handling every event?
|
||||
|
@@ -12,6 +12,8 @@
|
||||
#include "winutil.hpp"
|
||||
#include "undo.hpp"
|
||||
|
||||
extern short menuChoiceId;
|
||||
|
||||
using MenuHandle = NSMenu*;
|
||||
MenuHandle menu_bar_handle;
|
||||
MenuHandle file_menu, edit_menu, app_menu, scen_menu, town_menu, out_menu, help_menu;
|
||||
@@ -166,6 +168,7 @@ void update_edit_menu() {
|
||||
|
||||
@implementation MenuHandler
|
||||
-(void) menuChoice:(id) sender {
|
||||
handle_menu_choice(eMenu([[sender representedObject] intValue]));
|
||||
menuChoiceId=short([[sender representedObject] intValue]);
|
||||
//handle_menu_choice(eMenu([[sender representedObject] intValue]));
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user