From 060e43e79b6886b05e568e36af6d865403ba26c1 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Mon, 25 Jun 2001 06:36:22 +0000 Subject: Fixed a nasty chain of broken fixes to broken fixes to broken fixes, thus getting the shell refcounting in better shape. The quit sequence is still not quite right, but we are getting there. Also fixed a nasty bug in destroying the EStorageSet due to a very old commit by the Meekster. svn path=/trunk/; revision=10470 --- shell/ChangeLog | 17 +++++++++++++++++ shell/e-component-registry.c | 4 ---- shell/e-shell.c | 23 +++++++---------------- shell/e-storage-set.c | 2 +- shell/main.c | 3 +++ 5 files changed, 28 insertions(+), 21 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index 559e99f055..eec1daee99 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,20 @@ +2001-06-25 Ettore Perazzoli + + * e-storage-set.c (destroy): Use + `name_to_named_storage_foreach_destroy()' as the function argument + to `g_hash_table_foreach()', not `named_storage_destroy()', which + is just plainly wrong. + + * e-shell.c (setup_corba_storages): Don't ref the + corba_storage_registry here. + (destroy): Don't unref here. + (setup_activity_interface): Don't ref the activity_handler either. + (destroy): Don't unref it here. + + * e-component-registry.c (e_component_registry_construct): Don't + ref the shell here. + (destroy): Don't unref it here. + 2001-06-25 Ettore Perazzoli * main.c (no_views_left_cb): Don't call `e_shell_quit()' anymore. diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c index 693b7bf812..aa76ff0656 100644 --- a/shell/e-component-registry.c +++ b/shell/e-component-registry.c @@ -227,8 +227,6 @@ destroy (GtkObject *object) component_registry = E_COMPONENT_REGISTRY (object); priv = component_registry->priv; - bonobo_object_unref (BONOBO_OBJECT (priv->shell)); - g_hash_table_foreach (priv->component_id_to_component, component_id_foreach_free, NULL); g_hash_table_destroy (priv->component_id_to_component); @@ -273,8 +271,6 @@ e_component_registry_construct (EComponentRegistry *component_registry, g_return_if_fail (E_IS_SHELL (shell)); priv = component_registry->priv; - - bonobo_object_ref (BONOBO_OBJECT (shell)); priv->shell = shell; } diff --git a/shell/e-shell.c b/shell/e-shell.c index c642d991c6..595be5d55c 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -77,10 +77,10 @@ struct _EShellPrivate { EComponentRegistry *component_registry; - ECorbaStorageRegistry *corba_storage_registry; + ECorbaStorageRegistry *corba_storage_registry; /* */ /* ::Activity interface handler. */ - EActivityHandler *activity_handler; + EActivityHandler *activity_handler; /* */ /* This object handles going off-line. If the pointer is not NULL, it means we have a going-off-line process in progress. */ @@ -326,8 +326,6 @@ setup_activity_interface (EShell *shell) bonobo_object_add_interface (BONOBO_OBJECT (shell), BONOBO_OBJECT (activity_handler)); - - bonobo_object_ref (BONOBO_OBJECT (activity_handler)); priv->activity_handler = activity_handler; } @@ -351,10 +349,6 @@ setup_corba_storages (EShell *shell) bonobo_object_add_interface (BONOBO_OBJECT (shell), BONOBO_OBJECT (corba_storage_registry)); - /* Notice that `bonobo_object_add_interface()' aggregates the two object's - reference counts, so we need an extra ref here if we want to keep a separate - pointer to the storage interface. */ - bonobo_object_ref (BONOBO_OBJECT (corba_storage_registry)); priv->corba_storage_registry = corba_storage_registry; return TRUE; @@ -548,10 +542,9 @@ view_destroy_cb (GtkObject *object, shell->priv->views = g_list_remove (shell->priv->views, object); if (shell->priv->views == NULL) { - /* FIXME: This looks like a Bonobo bug to me. */ - bonobo_object_ref (BONOBO_OBJECT (shell)); + /* bonobo_object_ref (BONOBO_OBJECT (shell)); */ gtk_signal_emit (GTK_OBJECT (shell), signals [NO_VIEWS_LEFT]); - bonobo_object_unref (BONOBO_OBJECT (shell)); + /* bonobo_object_unref (BONOBO_OBJECT (shell)); */ } } @@ -605,11 +598,9 @@ destroy (GtkObject *object) g_list_free (priv->views); - if (priv->corba_storage_registry != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); - - if (priv->activity_handler != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->activity_handler)); + /* No unreffing for these as they are aggregate. */ + /* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */ + /* bonobo_object_unref (BONOBO_OBJECT (priv->activity_handler)); */ /* FIXME. Maybe we should do something special here. */ if (priv->offline_handler != NULL) diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index 07b4e66378..e5715dde11 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -258,7 +258,7 @@ destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (priv->folder_type_registry)); g_hash_table_foreach (priv->name_to_named_storage, - (GHFunc) named_storage_destroy, NULL); + (GHFunc) name_to_named_storage_foreach_destroy, NULL); g_hash_table_destroy (priv->name_to_named_storage); g_free (priv); diff --git a/shell/main.c b/shell/main.c index 57e3d6cea0..40e6d0aaad 100644 --- a/shell/main.c +++ b/shell/main.c @@ -59,6 +59,9 @@ no_views_left_cb (EShell *shell, gpointer data) /* FIXME: This is wrong. We should exit only when the shell is destroyed. But refcounting is broken at present, so this is a reasonable workaround for now. */ + + bonobo_object_unref (BONOBO_OBJECT (shell)); + gtk_main_quit (); } -- cgit