release the interface if we got it

2003-05-14  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

svn path=/trunk/; revision=21176
This commit is contained in:
JP Rosevear
2003-05-14 18:39:22 +00:00
committed by JP Rosevear
parent 6e8895d6e8
commit 74ee7fe6ae
6 changed files with 52 additions and 15 deletions

View File

@ -1,3 +1,25 @@
2003-05-14 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.

View File

@ -193,10 +193,9 @@ impl_StorageRegistry_getStorageByName (PortableServer_Servant servant,
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

View File

@ -77,7 +77,6 @@ storage_listener_servant_new (ECorbaStorage *corba_storage)
servant->servant.vepv = &storage_listener_vepv;
g_object_ref (corba_storage);
servant->storage = E_STORAGE (corba_storage);
return servant;
@ -86,8 +85,6 @@ storage_listener_servant_new (ECorbaStorage *corba_storage)
static void
storage_listener_servant_free (StorageListenerServant *servant)
{
g_object_unref (servant->storage);
g_free (servant);
}
@ -272,6 +269,7 @@ impl_dispose (GObject *object)
CORBA_free (object_id);
storage_listener_servant_free (priv->storage_listener_servant);
priv->storage_listener_servant = NULL;
}

View File

@ -598,6 +598,8 @@ setup_toolbar_button (EShellUserCreatableItemsHandler *handler,
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 @@ impl_dispose (GObject *object)
g_slist_free (priv->components);
priv->components = NULL;
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
}

View File

@ -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 @@ struct _EShellViewPrivate {
/* 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 @@ impl_dispose (GObject *object)
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 @@ init (EShellView *shell_view)
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 @@ e_shell_view_get_corba_interface (EShellView *shell_view)
priv = shell_view->priv;
return bonobo_object_corba_objref (BONOBO_OBJECT (priv->corba_interface));
return priv->corba_interface;
}
@ -2167,7 +2168,8 @@ setup_corba_interface (EShellView *shell_view,
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 @@ setup_corba_interface (EShellView *shell_view,
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 @@ get_view_for_uri (EShellView *shell_view,
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",

View File

@ -1632,6 +1632,8 @@ save_settings_for_component (EShell *shell,
CORBA_exception_free (&ev);
bonobo_object_release_unref (session_interface, NULL);
return retval;
}