shutting down bonobo-activation ...



Hi Maciej,

	I've been adding support for reference tracking, and all manner of
good things to ORBit2 - and I've been shutting down the ORB from bonobo;
problem is - bonobo doesn't really own the resources it's freeing. So ...
it would be conceptualy cleaner if I could have something like this patch
in there. To see this in action you need HEAD ORBit2 ( to actualy get some
warnings ), and HEAD libbonobo, and play with the tests / see
bonobo-main.c (bonobo_shutdown).

	Thanks,

		Michael.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo-activation/ChangeLog,v
retrieving revision 1.235
diff -u -r1.235 ChangeLog
--- ChangeLog	2001/10/25 09:16:35	1.235
+++ ChangeLog	2001/10/26 05:27:43
@@ -1,3 +1,9 @@
+2001-10-27  Michael Meeks  <michael ximian com>
+
+	* bonobo-activation/bonobo-activation-init.c
+	(bonobo_activation_shutdown): impl. to cleanup floating
+	resources.
+
 2001-10-26  Michael Meeks  <michael ximian com>

 	* bonobo-activation/bonobo-activation-shlib.c
Index: bonobo-activation/bonobo-activation-init.c
===================================================================
RCS file: /cvs/gnome/bonobo-activation/bonobo-activation/bonobo-activation-init.c,v
retrieving revision 1.40
diff -u -r1.40 bonobo-activation-init.c
--- bonobo-activation/bonobo-activation-init.c	2001/09/10 23:44:53	1.40
+++ bonobo-activation/bonobo-activation-init.c	2001/10/26 05:27:44
@@ -534,6 +534,39 @@
 	return bonobo_activation_orb;
 }

+int
+bonobo_activation_shutdown (void)
+{
+        int retval = 0;
+
+        if (is_initialized) {
+                CORBA_Environment ev;
+
+                CORBA_exception_init (&ev);
+
+                if (bonobo_activation_context != CORBA_OBJECT_NIL) {
+                        CORBA_Object_release (
+                                (CORBA_Object) bonobo_activation_context, &ev);
+                        bonobo_activation_context = CORBA_OBJECT_NIL;
+                }
+
+                if (bonobo_activation_orb != CORBA_OBJECT_NIL) {
+                        CORBA_ORB_destroy (bonobo_activation_orb, &ev);
+                        if (ev._major != CORBA_NO_EXCEPTION)
+                                retval = 1;
+                        CORBA_Object_release (
+                                (CORBA_Object) bonobo_activation_orb, &ev);
+                        is_initialized = FALSE;
+                }
+
+                CORBA_exception_free (&ev);
+
+        } else /* shutdown when we didn't need to error */
+		retval = 1;
+
+        return retval;
+}
+
 const char  bonobo_activation_version []    = VERSION;
 const guint bonobo_activation_major_version = BONOBO_ACTIVATION_MAJOR_VERSION;
 const guint bonobo_activation_minor_version = BONOBO_ACTIVATION_MINOR_VERSION;
Index: bonobo-activation/bonobo-activation-init.h
===================================================================
RCS file: /cvs/gnome/bonobo-activation/bonobo-activation/bonobo-activation-init.h,v
retrieving revision 1.4
diff -u -r1.4 bonobo-activation-init.h
--- bonobo-activation/bonobo-activation-init.h	2001/08/18 00:19:02	1.4
+++ bonobo-activation/bonobo-activation-init.h	2001/10/26 05:27:45
@@ -38,6 +38,7 @@
 gboolean       bonobo_activation_is_initialized   (void);
 CORBA_ORB      bonobo_activation_init       (int      argc,
                                              char   **argv);
+int            bonobo_activation_shutdown   (void);
 void           bonobo_activation_preinit    (gpointer app,
                                              gpointer mod_info);
 void           bonobo_activation_postinit   (gpointer app,

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




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