until we actually get somewhere with the menu crap... fix potential crashes when exiting.
This commit is contained in:
parent
c5670a22a5
commit
cbe63f8fd5
|
@ -77,6 +77,10 @@ static void areaWidget_init(areaWidget *aw)
|
|||
|
||||
static void areaWidget_dispose(GObject *obj)
|
||||
{
|
||||
// remove any draw order that might still be pending
|
||||
areaWidget *aw = areaWidget(obj);
|
||||
while (g_idle_remove_by_data(aw->a));
|
||||
|
||||
G_OBJECT_CLASS(areaWidget_parent_class)->dispose(obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ struct uiMenu {
|
|||
GArray *items; // []*uiMenuItem
|
||||
gboolean ischild;
|
||||
guint id;
|
||||
gboolean freed;
|
||||
};
|
||||
|
||||
struct uiMenuItem {
|
||||
|
@ -100,6 +99,22 @@ static void menuItemEnableDisable(uiMenuItem *item, gboolean enabled)
|
|||
g_hash_table_iter_init(&iter, item->windows);
|
||||
while (g_hash_table_iter_next(&iter, &widget, NULL))
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(widget), enabled);
|
||||
|
||||
// extra crummy code for disabling submenus
|
||||
// TODO: find a better way to do it!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// noting that:
|
||||
// * set_sensitive on the menu item does nothing (herpderp)
|
||||
// * set_sensitive on the submenu disables all the submenu items at once (but then you can't fucking enable them back!!)
|
||||
// * googling gives no results, guess nobody has ever wanted to do this shit or...??????
|
||||
// * under Windows we can just disable the menu item and call it good! works exactly as intended!
|
||||
// * fucking stupid pile of shit
|
||||
|
||||
/*if (item->popupchild != NULL)
|
||||
{
|
||||
g_hash_table_iter_init(&iter, item->windows);
|
||||
while (g_hash_table_iter_next(&iter, &widget, NULL))
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(gtk_menu_item_get_submenu(widget)), enabled);
|
||||
}*/
|
||||
}
|
||||
|
||||
void uiMenuItemEnable(uiMenuItem *item)
|
||||
|
@ -276,7 +291,6 @@ uiMenu *uiNewMenu(const char *name)
|
|||
m->name = g_strdup(name);
|
||||
m->items = g_array_new(FALSE, TRUE, sizeof (uiMenuItem *));
|
||||
m->ischild = FALSE;
|
||||
m->freed = FALSE;
|
||||
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -335,8 +335,6 @@ int EmuThreadFunc(void* burp)
|
|||
}
|
||||
else
|
||||
{
|
||||
EmuStatus = 2;
|
||||
|
||||
// paused
|
||||
nframes = 0;
|
||||
lasttick = SDL_GetTicks();
|
||||
|
@ -344,7 +342,13 @@ int EmuThreadFunc(void* burp)
|
|||
lastmeasuretick = lasttick;
|
||||
fpslimitcount = 0;
|
||||
|
||||
uiAreaQueueRedrawAll(MainDrawArea);
|
||||
if (EmuRunning == 2)
|
||||
{
|
||||
uiAreaQueueRedrawAll(MainDrawArea);
|
||||
}
|
||||
|
||||
EmuStatus = EmuRunning;
|
||||
|
||||
SDL_Delay(100);
|
||||
}
|
||||
}
|
||||
|
@ -792,6 +796,8 @@ void Stop(bool internal)
|
|||
if (!internal) // if shutting down from the UI thread, wait till the emu thread has stopped
|
||||
while (EmuStatus != 2);
|
||||
RunningSomething = false;
|
||||
|
||||
uiWindowSetTitle(MainWindow, "melonDS " MELONDS_VERSION);
|
||||
|
||||
uiMenuItemDisable(MenuItem_SaveState);
|
||||
uiMenuItemDisable(MenuItem_LoadState);
|
||||
|
@ -1026,11 +1032,8 @@ void UndoStateLoad()
|
|||
|
||||
int OnCloseWindow(uiWindow* window, void* blarg)
|
||||
{
|
||||
if (RunningSomething)
|
||||
{
|
||||
EmuRunning = 2;
|
||||
while (EmuStatus != 2);
|
||||
}
|
||||
EmuRunning = 3;
|
||||
while (EmuStatus != 3);
|
||||
|
||||
uiQuit();
|
||||
return 1;
|
||||
|
@ -1065,6 +1068,9 @@ void OnLoseFocus(uiWindow* window, void* blarg)
|
|||
|
||||
void OnCloseByMenu(uiMenuItem* item, uiWindow* window, void* blarg)
|
||||
{
|
||||
EmuRunning = 3;
|
||||
while (EmuStatus != 3);
|
||||
|
||||
uiControlDestroy(uiControl(window));
|
||||
uiQuit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue