Re: Bonobo 1.x moniker leak



Le ven 08/03/2002 à 17:42, Michael Meeks a écrit :
> Hi Frederic,
> 
> On Fri, 2002-03-08 at 14:39, Frederic Crozat wrote:
> > I've just found a (big) problem in current implementation of
> > BONOBO_OAF_FACTORY and BONOBO_OAF_FACTORY_MULTI in bonobo 1 branch..
> 
> 	Yes, the problem is as you say it is which sucks; it would be good to
> fix this in several places; first by not using this macro in the apps
> that stay lying around, and 2nd by committing a simple patch to handle
> factory == NULL - I'd prefer to do this by modifying the macro so that
> packages built with the new bonobo headers will run with the old bonobo
> etc. etc. it sucks but it's the best way to do it.

Yep, I had the same analysis..

> 	Can you post the patch as you commit ?

Here is the patch, as committed in CVS :

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.1168
diff -u -r1.1168 ChangeLog
--- ChangeLog	5 Mar 2002 15:54:56 -0000	1.1168
+++ ChangeLog	8 Mar 2002 16:52:25 -0000
@@ -1,3 +1,9 @@
+2002-03-08  Frederic Crozat  <fcrozat mandrakesoft com>
+
+	* bonobo/bonobo-generic-factory.h:
+	fix BONOBO_OAF_FACTORY and BONOBO_OAF_FACTORY_MULTI to really
+	exit if factory creation fails (backport from HEAD)
+
 2002-03-05  Michael Meeks  <michael ximian com>
 
 	* bonobo/bonobo-ui-config-widget.c
Index: bonobo/bonobo-generic-factory.h
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-generic-factory.h,v
retrieving revision 1.21
diff -u -r1.21 bonobo-generic-factory.h
--- bonobo/bonobo-generic-factory.h	24 Oct 2001 01:24:10 -0000	1.21
+++ bonobo/bonobo-generic-factory.h	8 Mar 2002 16:52:25 -0000
@@ -103,9 +103,14 @@
 	if (!bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL))           \
 		g_error (_("Could not initialize Bonobo"));                   \
 	factory = bonobo_generic_factory_new (oafiid, fn, data);              \
-	bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));     \
-	bonobo_main ();                                                       \
-	return 0;                                                             \
+	if (factory) {                                                        \
+		bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));   \
+		bonobo_main ();                                               \
+		return 0;                                                     \
+	}                                                                     \
+	else {                                                                \
+		return 1;                                                     \
+	}                                                                     \
 }                                                                             
 
 #define BONOBO_OAF_FACTORY_MULTI(oafiid, descr, version, fn, data)            \
@@ -120,9 +125,14 @@
 	if (!bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL))           \
 		g_error (_("Could not initialize Bonobo"));                   \
 	factory = bonobo_generic_factory_new_multi (oafiid, fn, data);        \
-	bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));     \
-	bonobo_main ();                                                       \
-	return 0;                                                             \
+	if (factory) {                                                        \
+		bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));   \
+		bonobo_main ();                                               \
+		return 0;                                                     \
+	}                                                                     \
+	else {                                                                \
+		return 1;                                                     \
+	}                                                                     \
 }                                                                             
 
 END_GNOME_DECLS

-- 
Frédéric Crozat
MandrakeSoft




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