From 8ab23573e7476045751de8b3c2a5e31656234a85 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 30 Oct 2001 21:57:15 +0000 Subject: New. (class_init): Install it. (impl_unsetOwner): Just emit the * evolution-shell-component.c (impl_owner_unset): New. (class_init): Install it. (impl_unsetOwner): Just emit the "owner_unset" signal as the default implementation for that signal does all the work now. (impl_owner_died): Set the owner_client to %NULL before unreffing it. (destroy): Likewise. (impl_owner_unset): Likewise. svn path=/trunk/; revision=14484 --- shell/ChangeLog | 11 +++++++++ shell/evolution-shell-component.c | 50 +++++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index bc51e17655..75d2d825c5 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,14 @@ +2001-10-30 Ettore Perazzoli + + * evolution-shell-component.c (impl_owner_unset): New. + (class_init): Install it. + (impl_unsetOwner): Just emit the "owner_unset" signal as the + default implementation for that signal does all the work now. + (impl_owner_died): Set the owner_client to %NULL before unreffing + it. + (destroy): Likewise. + (impl_owner_unset): Likewise. + 2001-10-30 Ettore Perazzoli * e-shell-view.c (e_shell_view_construct): Connect to the diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index 296ffe396c..37971be54e 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -194,8 +194,14 @@ owner_ping_callback (void *data) if (alive) return TRUE; - g_print ("\t*** The shell has disappeared\n"); - gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_DIED]); + /* This is tricky. During the pinging, we might have gotten an + ::unsetOwner invocation which has invalidated our owner_client. In + this case, no "owner_died" should be emitted. */ + + if (priv->owner_client != NULL) { + g_print ("\t*** The shell has disappeared\n"); + gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_DIED]); + } priv->ping_timeout_id = -1; @@ -403,14 +409,6 @@ impl_unsetOwner (PortableServer_Servant servant, return; } - if (priv->ping_timeout_id != -1) { - g_source_remove (priv->ping_timeout_id); - priv->ping_timeout_id = -1; - } - - bonobo_object_unref (BONOBO_OBJECT (priv->owner_client)); - priv->owner_client = NULL; - gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_UNSET]); } @@ -658,8 +656,13 @@ destroy (GtkObject *object) CORBA_exception_init (&ev); - if (priv->owner_client != NULL) - bonobo_object_unref (BONOBO_OBJECT (priv->owner_client)); + if (priv->owner_client != NULL) { + BonoboObject *owner_client_object; + + owner_client_object = BONOBO_OBJECT (priv->owner_client); + priv->owner_client = NULL; + bonobo_object_unref (BONOBO_OBJECT (owner_client_object)); + } CORBA_exception_free (&ev); @@ -691,15 +694,35 @@ destroy (GtkObject *object) /* EvolutionShellComponent methods. */ +static void +impl_owner_unset (EvolutionShellComponent *shell_component) +{ + EvolutionShellComponentPrivate *priv; + BonoboObject *owner_client_object; + + priv = shell_component->priv; + + if (priv->ping_timeout_id != -1) { + g_source_remove (priv->ping_timeout_id); + priv->ping_timeout_id = -1; + } + + owner_client_object = BONOBO_OBJECT (priv->owner_client); + priv->owner_client = NULL; + bonobo_object_unref (BONOBO_OBJECT (owner_client_object)); +} + static void impl_owner_died (EvolutionShellComponent *shell_component) { EvolutionShellComponentPrivate *priv; + BonoboObject *owner_client_object; priv = shell_component->priv; - bonobo_object_unref (BONOBO_OBJECT (priv->owner_client)); + owner_client_object = BONOBO_OBJECT (priv->owner_client); priv->owner_client = NULL; + bonobo_object_unref (BONOBO_OBJECT (owner_client_object)); /* The default implementation for ::owner_died emits ::owner_unset, so that we make the behavior for old components kind of correct without @@ -805,6 +828,7 @@ class_init (EvolutionShellComponentClass *klass) shell_component_class = EVOLUTION_SHELL_COMPONENT_CLASS (object_class); shell_component_class->owner_died = impl_owner_died; + shell_component_class->owner_unset = impl_owner_unset; } static void -- cgit v1.2.3