control popup menu race condition



Hey Michael,
	So the popup menu merging bug in the panel turned out to be a
re-entrancy problem in bonobo_control_get_popup_ui_container. Oh joy
of joys :/

	The patch below fixes it, may I commit ?

Cheers,
Mark.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libbonoboui/ChangeLog,v
retrieving revision 1.291
diff -u -p -r1.291 ChangeLog
--- ChangeLog	2002/02/26 16:08:54	1.291
+++ ChangeLog	2002/02/27 09:52:18
@@ -1,3 +1,9 @@
+2002-02-27  Mark McLoughlin  <mark skynet ie>
+
+	* bonobo/bonobo-control.c:
+	(bonobo_control_get_popup_ui_container): fix
+	race condition/re-entrancy bug.
+
 2002-02-26  Paolo Maggi  <maggi athena polito it>

 	* configure.in: now libbonoboui needs gtk+ 1.3.14
Index: bonobo/bonobo-control.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-control.c,v
retrieving revision 1.120
diff -u -p -r1.120 bonobo-control.c
--- bonobo/bonobo-control.c	2002/02/13 16:30:45	1.120
+++ bonobo/bonobo-control.c	2002/02/27 09:52:18
@@ -1201,15 +1201,24 @@ bonobo_control_get_popup_ui_container (B
 	g_return_val_if_fail (BONOBO_IS_CONTROL (control), NULL);

 	if (!control->priv->popup_ui_container) {
-		control->priv->popup_ui_engine = bonobo_ui_engine_new (
-			G_OBJECT (control));
+		BonoboUIEngine *ui_engine;
+		BonoboUISync   *ui_sync;

-		control->priv->popup_ui_sync = bonobo_ui_sync_menu_new (
-			control->priv->popup_ui_engine, NULL, NULL, NULL);
+		ui_engine = bonobo_ui_engine_new (G_OBJECT (control));

-		bonobo_ui_engine_add_sync (
-			control->priv->popup_ui_engine,
-			control->priv->popup_ui_sync);
+		ui_sync = bonobo_ui_sync_menu_new (ui_engine, NULL, NULL, NULL);
+
+		bonobo_ui_engine_add_sync (ui_engine, ui_sync);
+
+		/* re-entrancy guard */
+		if (control->priv->popup_ui_container) {
+			g_object_unref (ui_engine);
+
+			return control->priv->popup_ui_container;
+		}
+
+		control->priv->popup_ui_engine = ui_engine;
+		control->priv->popup_ui_sync   = ui_sync;

 		control->priv->popup_ui_container = bonobo_ui_container_new ();
 		bonobo_ui_container_set_engine (




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