Re: [evolution-patches] Bonobo Ref Counting Patches



One more update to the shell patch based on comments by ettore.

-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.
? bonobo-ref.patch
? old.txt
? old2.txt
? old3.txt
? ref.txt
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1271
diff -u -r1.1271 ChangeLog
--- ChangeLog	9 May 2003 15:00:46 -0000	1.1271
+++ ChangeLog	14 May 2003 15:59:11 -0000
@@ -1,3 +1,25 @@
+2003-05-13  JP Rosevear  <jpr ximian com>
+
+	* e-shell.c (save_settings_for_component): release the interface
+	if we got it
+
+	* e-shell-view.c: include bonobo-exception.h
+	(impl_dispose): release and unref the shell view corba interface
+	(init): init to CORBA_OBJECT_NIL
+	(e_shell_view_get_corba_interface): return the corba interface
+	(setup_corba_interface): release the existing shell view, add as
+	an interface and then query to get it back
+	(get_view_for_uri): release and unref the control once we create
+	the widget with it
+
+	* e-corba-storage.c (storage_listener_servant_new): don't ref ourselves
+	(storage_listener_servant_free): don't unref ourselves
+	(impl_dispose): free the servant info
+
+	* e-corba-storage-registry.c
+	(impl_StorageRegistry_getStorageByName): we need to ref as well as
+	duplicate since we didn't create the storage here
+
 2003-05-09  Jeremy Katz  <katzj redhat com>
 
 	* main.c: Add a #include to fix a warning.
Index: e-corba-storage-registry.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-corba-storage-registry.c,v
retrieving revision 1.30
diff -u -r1.30 e-corba-storage-registry.c
--- e-corba-storage-registry.c	13 Jan 2003 18:51:36 -0000	1.30
+++ e-corba-storage-registry.c	14 May 2003 15:59:11 -0000
@@ -193,10 +193,9 @@
 		return CORBA_OBJECT_NIL;
 	}
 
-	corba_storage = CORBA_Object_duplicate (e_corba_storage_get_corba_objref
-						(E_CORBA_STORAGE (storage)), ev);
+	corba_storage = e_corba_storage_get_corba_objref (E_CORBA_STORAGE (storage));
 
-	return corba_storage;
+	return bonobo_object_dup_ref (corba_storage, NULL);
 }
 
 static void
Index: e-corba-storage.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-corba-storage.c,v
retrieving revision 1.56
diff -u -r1.56 e-corba-storage.c
--- e-corba-storage.c	25 Apr 2003 17:03:51 -0000	1.56
+++ e-corba-storage.c	14 May 2003 15:59:11 -0000
@@ -77,7 +77,6 @@
 
 	servant->servant.vepv = &storage_listener_vepv;
 
-	g_object_ref (corba_storage);
 	servant->storage = E_STORAGE (corba_storage);
 
 	return servant;
@@ -86,8 +85,6 @@
 static void
 storage_listener_servant_free (StorageListenerServant *servant)
 {
-	g_object_unref (servant->storage);
-
 	g_free (servant);
 }
 
@@ -272,6 +269,7 @@
 
 		CORBA_free (object_id);
 
+		storage_listener_servant_free (priv->storage_listener_servant);
 		priv->storage_listener_servant = NULL;
 	}
 
Index: e-shell-user-creatable-items-handler.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-user-creatable-items-handler.c,v
retrieving revision 1.27
diff -u -r1.27 e-shell-user-creatable-items-handler.c
--- e-shell-user-creatable-items-handler.c	15 Apr 2003 21:27:08 -0000	1.27
+++ e-shell-user-creatable-items-handler.c	14 May 2003 15:59:12 -0000
@@ -598,6 +598,8 @@
 	bonobo_ui_component_object_set (ui_component, "/Toolbar/NewComboButton",
 					BONOBO_OBJREF (control), NULL);
 
+	bonobo_object_unref (control);
+	
 	g_object_set_data (G_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY, combo_button);
 
 	tooltips = gtk_tooltips_new ();
@@ -679,6 +681,7 @@
 	g_slist_free (priv->components);
 	priv->components = NULL;
 
+	
 	(* G_OBJECT_CLASS (parent_class)->dispose) (object);
 }
 
Index: e-shell-view.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-view.c,v
retrieving revision 1.283
diff -u -r1.283 e-shell-view.c
--- e-shell-view.c	8 May 2003 21:54:58 -0000	1.283
+++ e-shell-view.c	14 May 2003 15:59:12 -0000
@@ -66,6 +66,7 @@
 #include <gtk/gtkscrolledwindow.h>
 #include <gconf/gconf-client.h>
 
+#include <bonobo/bonobo-exception.h>
 #include <bonobo/bonobo-socket.h>
 #include <bonobo/bonobo-ui-util.h>
 #include <bonobo/bonobo-ui-container.h>
@@ -91,7 +92,7 @@
 
 	/* EvolutionShellView Bonobo object for implementing the
            Evolution::ShellView interface.  */
-	EvolutionShellView *corba_interface;
+	GNOME_Evolution_ShellView corba_interface;
 
 	/* The UI handler & container.  */
 	BonoboUIComponent *ui_component;
@@ -1464,9 +1465,9 @@
 		priv->shell = NULL;
 	}
 
-	if (priv->corba_interface != NULL) {
-		bonobo_object_unref (BONOBO_OBJECT (priv->corba_interface));
-		priv->corba_interface = NULL;
+	if (priv->corba_interface != CORBA_OBJECT_NIL) {
+		bonobo_object_release_unref (priv->corba_interface, NULL);
+		priv->corba_interface = CORBA_OBJECT_NIL;
 	}
 
 	if (priv->folder_bar_popup != NULL) {
@@ -1582,7 +1583,7 @@
 	priv = g_new (EShellViewPrivate, 1);
 
 	priv->shell                   = NULL;
-	priv->corba_interface         = NULL;
+	priv->corba_interface         = CORBA_OBJECT_NIL;
 	priv->ui_component            = NULL;
 	priv->history                 = e_history_new ((EHistoryItemFreeFunc) g_free);
 	priv->uri                     = NULL;
@@ -1900,7 +1901,7 @@
 
 	priv = shell_view->priv;
 
-	return bonobo_object_corba_objref (BONOBO_OBJECT (priv->corba_interface));
+	return priv->corba_interface;
 }
 
 
@@ -2167,7 +2168,8 @@
 	EShellViewPrivate *priv;
 	BonoboControlFrame *control_frame;
 	EvolutionShellView *corba_interface;
-
+	CORBA_Environment ev;
+	
 	g_return_if_fail (control != NULL);
 
 	priv = shell_view->priv;
@@ -2191,8 +2193,18 @@
 	bonobo_object_add_interface (BONOBO_OBJECT (control_frame),
 				     BONOBO_OBJECT (corba_interface));
 
-	bonobo_object_ref (BONOBO_OBJECT (corba_interface));
-	priv->corba_interface = corba_interface;
+
+	/* Get rid of the existing one first */
+	bonobo_object_release_unref (priv->corba_interface, NULL);
+
+	/* Now find the existing one */
+	CORBA_exception_init (&ev);
+	priv->corba_interface = Bonobo_Unknown_queryInterface (BONOBO_OBJREF (control_frame),
+							       "IDL:GNOME/Evolution/ShellView:1.0",
+							       &ev);
+	if (BONOBO_EX (&ev))
+		priv->corba_interface = CORBA_OBJECT_NIL;
+	CORBA_exception_free (&ev);
 }
 
 
@@ -2339,6 +2351,7 @@
 
 	container = bonobo_ui_component_get_container (priv->ui_component);
 	control = bonobo_widget_new_control_from_objref (corba_control, container);
+	bonobo_object_release_unref (corba_control, NULL);
 
 	socket = find_socket (GTK_CONTAINER (control));
 	destroy_connection_id = g_signal_connect (socket, "destroy",
Index: e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.213
diff -u -r1.213 e-shell.c
--- e-shell.c	15 Apr 2003 21:27:08 -0000	1.213
+++ e-shell.c	14 May 2003 15:59:13 -0000
@@ -1632,6 +1632,8 @@
 
 	CORBA_exception_free (&ev);
 
+	bonobo_object_release_unref (session_interface, NULL);
+
 	return retval;
 }
 


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