aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-10-26 07:37:32 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-10-26 07:37:32 +0800
commit79c7cb13de4039e531aaaa1d38418c19ca26e5e6 (patch)
tree0172d069838eb09e70a1bdfd1fc0dfb2a1b98115
parent9900118629b138dd2445a2656f60784f0f68bb33 (diff)
downloadgsoc2013-evolution-79c7cb13de4039e531aaaa1d38418c19ca26e5e6.tar.gz
gsoc2013-evolution-79c7cb13de4039e531aaaa1d38418c19ca26e5e6.tar.zst
gsoc2013-evolution-79c7cb13de4039e531aaaa1d38418c19ca26e5e6.zip
New helper function. (e_component_registry_restart_component): Use it.
* e-component-registry.c (wait_for_corba_object_to_die): New helper function. (e_component_registry_restart_component): Use it. (component_free): Call it to wait for the unowned object to die. svn path=/trunk/; revision=14110
-rw-r--r--shell/ChangeLog7
-rw-r--r--shell/e-component-registry.c45
2 files changed, 37 insertions, 15 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index a2e060900c..8a1ff8c643 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,12 @@
2001-10-25 Ettore Perazzoli <ettore@ximian.com>
+ * e-component-registry.c (wait_for_corba_object_to_die): New
+ helper function.
+ (e_component_registry_restart_component): Use it.
+ (component_free): Call it to wait for the unowned object to die.
+
+2001-10-25 Ettore Perazzoli <ettore@ximian.com>
+
* e-shell.c (impl_Shell_selectUserFolder): Handle failure from
XGetClassHint properly. Also, free res_name and res_class in case
of success. Fixes #13554.
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index ffa3769000..7448e1b4a8 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -59,6 +59,28 @@ struct _EComponentRegistryPrivate {
};
+/* Utility functions. */
+
+static void
+wait_for_corba_object_to_die (Bonobo_Unknown corba_objref,
+ const char *id)
+{
+ gboolean alive;
+ int count;
+
+ count = 1;
+ while (1) {
+ alive = bonobo_unknown_ping (corba_objref);
+ if (! alive)
+ break;
+
+ g_print ("Waiting for component to die -- %s (%d)\n", id, count);
+ sleep (1);
+ count ++;
+ }
+}
+
+
/* Component information handling. */
static Component *
@@ -84,9 +106,11 @@ component_free (Component *component)
CORBA_Environment ev;
gboolean retval;
+ CORBA_exception_init (&ev);
+
corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (component->client));
+ corba_shell_component = CORBA_Object_duplicate (corba_shell_component, &ev);
- CORBA_exception_init (&ev);
GNOME_Evolution_ShellComponent_unsetOwner (corba_shell_component, &ev);
if (ev._major == CORBA_NO_EXCEPTION)
retval = TRUE;
@@ -94,11 +118,13 @@ component_free (Component *component)
retval = FALSE;
CORBA_exception_free (&ev);
- g_free (component->id);
-
bonobo_object_unref (BONOBO_OBJECT (component->client));
+ wait_for_corba_object_to_die (corba_shell_component, component->id);
+ CORBA_Object_release (corba_shell_component, &ev);
+
e_free_string_list (component->folder_type_names);
+ g_free (component->id);
g_free (component);
@@ -419,8 +445,6 @@ e_component_registry_restart_component (EComponentRegistry *component_registry,
Component *component;
CORBA_Environment ev;
CORBA_Object corba_objref;
- gboolean alive;
- int count;
g_return_val_if_fail (component_registry != NULL, NULL);
g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (component_registry), NULL);
@@ -440,16 +464,7 @@ e_component_registry_restart_component (EComponentRegistry *component_registry,
component_free (component);
- count = 1;
- while (1) {
- alive = bonobo_unknown_ping (corba_objref);
- if (! alive)
- break;
-
- g_print ("Waiting for component to die -- %s (%d)\n", id, count);
- sleep (1);
- count ++;
- }
+ wait_for_corba_object_to_die (component, id);
CORBA_exception_free (&ev);