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
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
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>
|
2001-10-25 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
* e-shell.c (impl_Shell_selectUserFolder): Handle failure from
|
* e-shell.c (impl_Shell_selectUserFolder): Handle failure from
|
||||||
|
@ -58,6 +58,28 @@ struct _EComponentRegistryPrivate {
|
|||||||
GHashTable *component_id_to_component;
|
GHashTable *component_id_to_component;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* 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. */
|
/* Component information handling. */
|
||||||
|
|
||||||
@ -84,9 +106,11 @@ component_free (Component *component)
|
|||||||
CORBA_Environment ev;
|
CORBA_Environment ev;
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
|
|
||||||
corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (component->client));
|
|
||||||
|
|
||||||
CORBA_exception_init (&ev);
|
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);
|
||||||
|
|
||||||
GNOME_Evolution_ShellComponent_unsetOwner (corba_shell_component, &ev);
|
GNOME_Evolution_ShellComponent_unsetOwner (corba_shell_component, &ev);
|
||||||
if (ev._major == CORBA_NO_EXCEPTION)
|
if (ev._major == CORBA_NO_EXCEPTION)
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
@ -94,11 +118,13 @@ component_free (Component *component)
|
|||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
CORBA_exception_free (&ev);
|
CORBA_exception_free (&ev);
|
||||||
|
|
||||||
g_free (component->id);
|
|
||||||
|
|
||||||
bonobo_object_unref (BONOBO_OBJECT (component->client));
|
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);
|
e_free_string_list (component->folder_type_names);
|
||||||
|
g_free (component->id);
|
||||||
|
|
||||||
g_free (component);
|
g_free (component);
|
||||||
|
|
||||||
@ -419,8 +445,6 @@ e_component_registry_restart_component (EComponentRegistry *component_registry,
|
|||||||
Component *component;
|
Component *component;
|
||||||
CORBA_Environment ev;
|
CORBA_Environment ev;
|
||||||
CORBA_Object corba_objref;
|
CORBA_Object corba_objref;
|
||||||
gboolean alive;
|
|
||||||
int count;
|
|
||||||
|
|
||||||
g_return_val_if_fail (component_registry != NULL, NULL);
|
g_return_val_if_fail (component_registry != NULL, NULL);
|
||||||
g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (component_registry), 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);
|
component_free (component);
|
||||||
|
|
||||||
count = 1;
|
wait_for_corba_object_to_die (component, id);
|
||||||
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 ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
CORBA_exception_free (&ev);
|
CORBA_exception_free (&ev);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user