[gimp/gimp-2-8] app: use an idle source to dispatch GTK menu events in ige-mac-menu



commit 668891e7455ff9107901b004e7ce9d422041ef71
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Fri May 25 03:42:36 2012 -0700

    app: use an idle source to dispatch GTK menu events in ige-mac-menu
    
    in order to work around the crashes in bug #673264 and bug #674108.
    (cherry picked from commit c1786fe753174a92a271a1acfe729c88495012c1)

 app/gui/ige-mac-menu.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/app/gui/ige-mac-menu.c b/app/gui/ige-mac-menu.c
index 5e3579a..c352f8f 100644
--- a/app/gui/ige-mac-menu.c
+++ b/app/gui/ige-mac-menu.c
@@ -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;
 		}
 	    }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]