[PATCH] for bad re-enterancy problem on slow machines



Hi

Now that we load all CORBA components and most processes asynchronously,
a bug has shown in our tests on slow machines, making out-of-process
applets crash when started.

Attached patch fixes it, already approved by libbonobo maintainer, mr
meeks :)
-- 
Rodrigo Moya <rodrigo novell com>
? libbonobo-zip
? po/stamp-it
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libbonobo/ChangeLog,v
retrieving revision 1.607
diff -u -p -r1.607 ChangeLog
--- ChangeLog	7 Feb 2006 12:24:03 -0000	1.607
+++ ChangeLog	7 Mar 2006 13:43:20 -0000
@@ -1,3 +1,14 @@
+2006-03-07  Michael Meeks <michael meeks novell com>
+
+	* activation-server/object-directory-activate.c
+	(od_server_activate_factory): keep private copy of data we need,
+	since it can be freed due to re-enterancy.
+	(od_server_activate_exe): ditto.
+
+	* activation-server/object-directory-corba.c
+	(impl_Bonobo_ObjectDirectory_activate): added comment to explain
+	new situation.
+
 2006-02-07  Michael Meeks  <michael meeks novell com>
 
 	* bonobo-activation/bonobo-activation-init.c
Index: activation-server/object-directory-activate.c
===================================================================
RCS file: /cvs/gnome/libbonobo/activation-server/object-directory-activate.c,v
retrieving revision 1.31
diff -u -p -r1.31 object-directory-activate.c
--- activation-server/object-directory-activate.c	22 Feb 2005 12:08:44 -0000	1.31
+++ activation-server/object-directory-activate.c	7 Mar 2006 13:43:20 -0000
@@ -50,17 +50,20 @@ od_server_activate_factory (Bonobo_Serve
 	CORBA_Object             retval = CORBA_OBJECT_NIL;
 	CORBA_Object             factory = CORBA_OBJECT_NIL;
 	char                    *requirements;
+        char                    *iid;
 
 	memset (&selorder, 0, sizeof (Bonobo_StringList));
 
 	requirements = g_alloca (strlen (si->location_info) + sizeof ("iid == ''"));
 	sprintf (requirements, "iid == '%s'", si->location_info);
+        iid = g_strdup (si->iid);
 
 	flags = ((actinfo->flags | Bonobo_ACTIVATION_FLAG_NO_LOCAL) & (~Bonobo_ACTIVATION_FLAG_PRIVATE));
 
 	res = Bonobo_ActivationContext_activateMatchingFull (
 			actinfo->ac, requirements, &selorder,
 			environment, flags, client, actinfo->ctx, ev);
+        /* NB. si can have been freed - due to re-enterancy */
 
 	if (ev->_major != CORBA_NO_EXCEPTION)
 		goto out;
@@ -78,13 +81,14 @@ od_server_activate_factory (Bonobo_Serve
 		break;
 	}
 
-	retval = Bonobo_GenericFactory_createObject (factory, si->iid, ev);
+	retval = Bonobo_GenericFactory_createObject (factory, iid, ev);
 	if (ev->_major != CORBA_NO_EXCEPTION)
 		retval = CORBA_OBJECT_NIL;
 
 	CORBA_free (res);
 
  out:
+        g_free (iid);
 	return retval;
 }
 
@@ -100,7 +104,7 @@ od_server_activate_exe (Bonobo_ServerInf
 	char *extra_arg, *ctmp, *ctmp2;
         int fd_arg;
 	int i;
-        char *iorstr;
+        char *iorstr, *iid;
         CORBA_Object retval;
 
 	/* Munge the args */
@@ -156,9 +160,11 @@ od_server_activate_exe (Bonobo_ServerInf
          * this allows people to destroy all OAF servers along with oafd
          * if necessary
          */
+        iid = g_strdup (si->iid);
 	retval = bonobo_activation_server_by_forking (
                 (const char **) args, TRUE, fd_arg, environment, iorstr,
-                si->iid, FALSE, bonobo_object_directory_re_check_fn, actinfo, ev);
+                iid, FALSE, bonobo_object_directory_re_check_fn, actinfo, ev);
+        g_free (iid);
         
 	CORBA_free (iorstr);
 
Index: activation-server/object-directory-corba.c
===================================================================
RCS file: /cvs/gnome/libbonobo/activation-server/object-directory-corba.c,v
retrieving revision 1.79
diff -u -p -r1.79 object-directory-corba.c
--- activation-server/object-directory-corba.c	22 Dec 2005 15:14:14 -0000	1.79
+++ activation-server/object-directory-corba.c	7 Mar 2006 13:43:20 -0000
@@ -503,6 +503,7 @@ impl_Bonobo_ObjectDirectory_activate (
 	if (si) {
 		retval = od_server_activate (
 				si, &ai, BONOBO_OBJREF (od), &merged_environment, client, ev);
+                /* NB. si can now be invalid - due to re-enterancy */
 
                 /* If we failed to activate - it may be because our
                  * request re-entered _during_ the activation


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