oaf / bonobo patch ...



	So it transpires the fix or workaround for the shlib activation
factory issue is to pretty much ignore the return value from the oaf
registration.

	It seems to me there needs to be a more robust definition of the
difference between shlib and out of proc components wrt. their
registration and activation. And preferably shlib component registration
would stay fully in-proc to avoid round trips. Anyway, that's for the
future - for  now; this works:

	Hmm,

		Michael.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.1129
diff -u -r1.1129 ChangeLog
--- ChangeLog	2001/10/23 05:28:05	1.1129
+++ ChangeLog	2001/10/24 01:21:35
@@ -1,3 +1,16 @@
+2001-10-25  Michael Meeks  <michael ximian com>
+
+	* bonobo/bonobo-shlib-factory.c
+	(bonobo_shlib_factory_construct): use the noregister
+	variant, register with oaf ourself, and only fail on
+	OAF_REG_ERROR - since we want the shlib in-proc, and
+	not possibly out of proc, and oaf wants to always
+	activate us as a shlib, even if we're already
+	registered really.
+
+	* bonobo/bonobo-generic-factory.c
+	(bonobo_generic_factory_construct_noregister): impl.
+
 2001-10-24  Michael Meeks  <michael ximian com>

 	* bonobo/bonobo-xobject.c (bonobo_x_object_class_init):
Index: bonobo/bonobo-generic-factory.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-generic-factory.c,v
retrieving revision 1.25
diff -u -r1.25 bonobo-generic-factory.c
--- bonobo/bonobo-generic-factory.c	2001/10/22 00:28:59	1.25
+++ bonobo/bonobo-generic-factory.c	2001/10/24 01:21:35
@@ -85,6 +85,32 @@
 	return bonobo_object_activate_servant_full (object, servant, shlib_id);
 }

+
+BonoboGenericFactory *
+bonobo_generic_factory_construct_noregister (const char             *oaf_iid,
+					     BonoboGenericFactory   *c_factory,
+					     CORBA_Object            corba_factory,
+					     BonoboGenericFactoryFn  factory,
+					     GnomeFactoryCallback    factory_cb,
+					     gpointer                user_data)
+{
+	g_return_val_if_fail (c_factory != NULL, NULL);
+	g_return_val_if_fail (BONOBO_IS_GENERIC_FACTORY (c_factory), NULL);
+	g_return_val_if_fail (corba_factory != CORBA_OBJECT_NIL, NULL);
+
+	bonobo_object_construct (BONOBO_OBJECT (c_factory), corba_factory);
+
+	bonobo_running_context_ignore_object (corba_factory);
+
+	c_factory->factory         = factory;
+	c_factory->factory_cb      = factory_cb;
+	c_factory->factory_closure = user_data;
+	c_factory->oaf_iid         = g_strdup (oaf_iid);
+
+	return c_factory;
+}
+
+
 /**
  * bonobo_generic_factory_construct:
  * @oaf_iid: The GOAD id that the new factory will implement.
@@ -114,22 +140,16 @@
 	g_return_val_if_fail (c_factory != NULL, NULL);
 	g_return_val_if_fail (BONOBO_IS_GENERIC_FACTORY (c_factory), NULL);
 	g_return_val_if_fail (corba_factory != CORBA_OBJECT_NIL, NULL);
-
-	bonobo_object_construct (BONOBO_OBJECT (c_factory), corba_factory);

-	bonobo_running_context_ignore_object (corba_factory);
-
-	c_factory->factory         = factory;
-	c_factory->factory_cb      = factory_cb;
-	c_factory->factory_closure = user_data;
-	c_factory->oaf_iid         = g_strdup (oaf_iid);
+	bonobo_generic_factory_construct_noregister (
+		oaf_iid, c_factory, corba_factory, factory, factory_cb, user_data);

 	ret = oaf_active_server_register (c_factory->oaf_iid, corba_factory);

 	if (ret != OAF_REG_SUCCESS) {
 		bonobo_object_unref (BONOBO_OBJECT (c_factory));
 		return NULL;
-	}
+	}

 	return c_factory;
 }
Index: bonobo/bonobo-generic-factory.h
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-generic-factory.h,v
retrieving revision 1.20
diff -u -r1.20 bonobo-generic-factory.h
--- bonobo/bonobo-generic-factory.h	2001/04/23 20:47:11	1.20
+++ bonobo/bonobo-generic-factory.h	2001/10/24 01:21:35
@@ -76,6 +76,14 @@
 	GnomeFactoryCallback   factory_cb,
 	gpointer               user_data);

+BonoboGenericFactory *bonobo_generic_factory_construct_noregister (
+	const char             *oaf_iid,
+	BonoboGenericFactory   *c_factory,
+	CORBA_Object            corba_factory,
+	BonoboGenericFactoryFn  factory,
+	GnomeFactoryCallback    factory_cb,
+	gpointer                user_data);
+
 void bonobo_generic_factory_set (
 	BonoboGenericFactory  *c_factory,
 	BonoboGenericFactoryFn factory,
Index: bonobo/bonobo-shlib-factory.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-shlib-factory.c,v
retrieving revision 1.5
diff -u -r1.5 bonobo-shlib-factory.c
--- bonobo/bonobo-shlib-factory.c	2001/02/06 22:41:28	1.5
+++ bonobo/bonobo-shlib-factory.c	2001/10/24 01:21:37
@@ -53,6 +53,9 @@
 				GnomeFactoryCallback   factory_cb,
 				gpointer               user_data)
 {
+	BonoboGenericFactory *r_factory;
+	int ret;
+
 	g_return_val_if_fail (c_factory != NULL, NULL);
 	g_return_val_if_fail (BONOBO_IS_SHLIB_FACTORY (c_factory), NULL);
 	g_return_val_if_fail (corba_factory != CORBA_OBJECT_NIL, NULL);
@@ -61,11 +64,21 @@
 	c_factory->oaf_impl_ptr = oaf_impl_ptr;

         oaf_plugin_use (poa, oaf_impl_ptr);
+
+	r_factory = bonobo_generic_factory_construct_noregister (
+		oaf_iid, BONOBO_GENERIC_FACTORY (c_factory),
+		corba_factory, factory, factory_cb, user_data);
+
+	if (r_factory) {
+		ret = oaf_active_server_register (r_factory->oaf_iid, corba_factory);
+
+		if (ret == OAF_REG_ERROR) {
+			bonobo_object_unref (BONOBO_OBJECT (r_factory));
+			return NULL;
+		}
+	}

-	return BONOBO_SHLIB_FACTORY (
-		bonobo_generic_factory_construct (
-			oaf_iid, BONOBO_GENERIC_FACTORY (c_factory),
-			corba_factory, factory, factory_cb, user_data));
+	return (BonoboShlibFactory *) r_factory;
 }

 /**

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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