app: use an idle source to dispatch GTK menu events in ige-mac-menu

in order to work around the crashes in bug  and bug .
This commit is contained in:
Daniel Sabo 2012-05-25 03:42:36 -07:00 committed by Michael Natterer
parent e254fd7c4d
commit c1786fe753
1 changed files with 21 additions and 1 deletions

View File

@ -502,6 +502,13 @@ carbon_menu_item_connect (GtkWidget *menu_item,
return carbon_item;
}
static gboolean
menu_event_activate_callback (GtkMenuItem *widget)
{
gtk_menu_item_activate (GTK_MENU_ITEM (widget));
return FALSE;
}
/*
* carbon event handler
@ -545,7 +552,20 @@ menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
sizeof (widget), 0, &widget);
if (err == noErr && GTK_IS_WIDGET (widget))
{
gtk_menu_item_activate (GTK_MENU_ITEM (widget));
GSource *source;
GClosure *closure;
closure = g_cclosure_new (G_CALLBACK (menu_event_activate_callback),
widget, NULL);
g_object_watch_closure (G_OBJECT (widget), closure);
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_HIGH);
g_source_set_closure (source, closure);
g_source_attach (source, NULL);
g_source_unref (source);
return noErr;
}
}