aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog13
-rw-r--r--shell/evolution-activity-client.c37
-rw-r--r--shell/evolution-shell-component-client.c101
3 files changed, 98 insertions, 53 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 07896c83be..b67c9ac737 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,16 @@
+2001-07-26 Ettore Perazzoli <ettore@ximian.com>
+
+ * evolution-activity-client.c (impl_destroy): Remove the source
+ for the timeout *before* invoking the CORBA method, as we might
+ get the timeout callback while invoking the CORBA method, thus
+ screwing things up.
+
+ * evolution-shell-component-client.c (destroy_listener_interface):
+ New helper function.
+ (dispatch_callback): Use it.
+ (impl_destroy): Call it when destroying the listener interface
+ instead of just freeing the servant.
+
2001-07-26 Jason Leach <jleach@ximian.com>
* e-shell-view-menu.c (update_offline_menu_item): Little UI thing:
diff --git a/shell/evolution-activity-client.c b/shell/evolution-activity-client.c
index 60e9f949d9..3846719cc7 100644
--- a/shell/evolution-activity-client.c
+++ b/shell/evolution-activity-client.c
@@ -77,6 +77,9 @@ struct _EvolutionActivityClientPrivate {
};
+#define DEBUG() g_print ("*** ActivityClient: %s %p [%ld]\n", __FUNCTION__, activity_client, (long) pthread_self ())
+
+
/* Utility functions. */
/* Create an icon from @pixbuf in @icon_return. */
@@ -188,6 +191,8 @@ update_timeout_callback (void *data)
activity_client = EVOLUTION_ACTIVITY_CLIENT (data);
priv = activity_client->priv;
+ DEBUG ();
+
if (priv->have_pending_update) {
corba_update_progress (activity_client, priv->new_information, priv->new_progress);
priv->have_pending_update = FALSE;
@@ -233,6 +238,14 @@ impl_destroy (GtkObject *object)
activity_client = EVOLUTION_ACTIVITY_CLIENT (object);
priv = activity_client->priv;
+ DEBUG ();
+
+ if (priv->next_update_timeout_id != 0)
+ g_source_remove (priv->next_update_timeout_id);
+
+ g_print ("*** ActivityClient: g_source_remove %d %p [%ld]\n",
+ priv->next_update_timeout_id, activity_client, (long) pthread_self ());
+
CORBA_exception_init (&ev);
if (! CORBA_Object_is_nil (priv->activity_interface, &ev)) {
@@ -248,9 +261,6 @@ impl_destroy (GtkObject *object)
CORBA_exception_free (&ev);
- if (priv->next_update_timeout_id != 0)
- g_source_remove (priv->next_update_timeout_id);
-
g_free (priv->new_information);
g_free (priv);
@@ -294,6 +304,8 @@ init (EvolutionActivityClient *activity_client)
{
EvolutionActivityClientPrivate *priv;
+ DEBUG ();
+
priv = g_new (EvolutionActivityClientPrivate, 1);
priv->activity_interface = CORBA_OBJECT_NIL;
priv->listener = bonobo_listener_new (listener_callback, activity_client);
@@ -330,6 +342,8 @@ evolution_activity_client_construct (EvolutionActivityClient *activity_client,
g_return_val_if_fail (information != NULL, FALSE);
g_return_val_if_fail (suggest_display_return != NULL, FALSE);
+ DEBUG ();
+
priv = activity_client->priv;
g_return_val_if_fail (priv->activity_interface == CORBA_OBJECT_NIL, FALSE);
@@ -384,6 +398,8 @@ evolution_activity_client_new (EvolutionShellClient *shell_client,
activity_client = gtk_type_new (evolution_activity_client_get_type ());
+ DEBUG ();
+
if (! evolution_activity_client_construct (activity_client,
shell_client,
component_id,
@@ -412,6 +428,8 @@ evolution_activity_client_update (EvolutionActivityClient *activity_client,
g_return_val_if_fail (information != NULL, FALSE);
g_return_val_if_fail (progress >= 0.0 && progress <= 1.0, FALSE);
+ DEBUG ();
+
priv = activity_client->priv;
if (priv->next_update_timeout_id == 0) {
@@ -427,6 +445,9 @@ evolution_activity_client_update (EvolutionActivityClient *activity_client,
update_timeout_callback,
activity_client);
+ g_print ("*** ActivityClient: g_timeout_add %d %p [%ld]\n",
+ priv->next_update_timeout_id, activity_client, (long) pthread_self ());
+
priv->have_pending_update = FALSE;
} else {
/* There is a pending timeout, so the last CORBA update
@@ -446,17 +467,19 @@ evolution_activity_client_update (EvolutionActivityClient *activity_client,
}
GNOME_Evolution_Activity_DialogAction
-evolution_activity_client_request_dialog (EvolutionActivityClient *client,
+evolution_activity_client_request_dialog (EvolutionActivityClient *activity_client,
GNOME_Evolution_Activity_DialogType dialog_type)
{
EvolutionActivityClientPrivate *priv;
GNOME_Evolution_Activity_DialogAction retval;
CORBA_Environment ev;
- g_return_val_if_fail (client != NULL, GNOME_Evolution_Activity_DIALOG_ACTION_ERROR);
- g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (client), GNOME_Evolution_Activity_DIALOG_ACTION_ERROR);
+ g_return_val_if_fail (activity_client != NULL, GNOME_Evolution_Activity_DIALOG_ACTION_ERROR);
+ g_return_val_if_fail (EVOLUTION_IS_ACTIVITY_CLIENT (activity_client), GNOME_Evolution_Activity_DIALOG_ACTION_ERROR);
+
+ priv = activity_client->priv;
- priv = client->priv;
+ DEBUG ();
CORBA_exception_init (&ev);
diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c
index 47059377d0..8d41f20785 100644
--- a/shell/evolution-shell-component-client.c
+++ b/shell/evolution-shell-component-client.c
@@ -111,6 +111,8 @@ static POA_GNOME_Evolution_ShellComponentListener__vepv ShellComponentListener_v
static gboolean ShellComponentListener_vepv_initialized = FALSE;
static void ShellComponentListener_vepv_initialize (void);
+static void dispatch_callback (EvolutionShellComponentClient *shell_component_client,
+ EvolutionShellComponentResult result);
struct _ShellComponentListenerServant {
POA_GNOME_Evolution_ShellComponentListener servant;
@@ -172,48 +174,6 @@ result_from_async_corba_result (GNOME_Evolution_ShellComponentListener_Result as
}
static void
-dispatch_callback (EvolutionShellComponentClient *shell_component_client,
- EvolutionShellComponentResult result)
-{
- EvolutionShellComponentClientPrivate *priv;
- EvolutionShellComponentClientCallback callback;
- PortableServer_ObjectId *oid;
- void *callback_data;
- CORBA_Environment ev;
-
- priv = shell_component_client->priv;
-
- g_return_if_fail (priv->callback != NULL);
- g_return_if_fail (priv->listener_servant != NULL);
-
- /* Notice that we destroy the interface and reset the callback information before
- dispatching the callback so that the callback can generate another request. */
-
- CORBA_exception_init (&ev);
-
- oid = PortableServer_POA_servant_to_id (bonobo_poa (), priv->listener_servant, &ev);
- PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev);
- POA_GNOME_Evolution_ShellComponentListener__fini (priv->listener_servant, &ev);
- CORBA_free (oid);
-
- CORBA_Object_release (priv->listener_interface, &ev);
- free_ShellComponentListener_servant (priv->listener_servant);
-
- CORBA_exception_free (&ev);
-
- priv->listener_servant = NULL;
- priv->listener_interface = CORBA_OBJECT_NIL;
-
- callback = priv->callback;
- callback_data = priv->callback_data;
-
- priv->callback = NULL;
- priv->callback_data = NULL;
-
- (* callback) (shell_component_client, result, callback_data);
-}
-
-static void
impl_ShellComponentListener_report_result (PortableServer_Servant servant,
const GNOME_Evolution_ShellComponentListener_Result result,
CORBA_Environment *ev)
@@ -273,6 +233,57 @@ create_listener_interface (EvolutionShellComponentClient *shell_component_client
priv->listener_interface = corba_interface;
}
+static void
+destroy_listener_interface (EvolutionShellComponentClient *client)
+{
+ EvolutionShellComponentClientPrivate *priv;
+ CORBA_Environment ev;
+ PortableServer_ObjectId *oid;
+
+ priv = client->priv;
+ CORBA_exception_init (&ev);
+
+ oid = PortableServer_POA_servant_to_id (bonobo_poa (), priv->listener_servant, &ev);
+ PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev);
+ POA_GNOME_Evolution_ShellComponentListener__fini (priv->listener_servant, &ev);
+ CORBA_free (oid);
+
+ CORBA_Object_release (priv->listener_interface, &ev);
+ free_ShellComponentListener_servant (priv->listener_servant);
+
+ CORBA_exception_free (&ev);
+}
+
+static void
+dispatch_callback (EvolutionShellComponentClient *shell_component_client,
+ EvolutionShellComponentResult result)
+{
+ EvolutionShellComponentClientPrivate *priv;
+ EvolutionShellComponentClientCallback callback;
+ void *callback_data;
+
+ priv = shell_component_client->priv;
+
+ g_return_if_fail (priv->callback != NULL);
+ g_return_if_fail (priv->listener_servant != NULL);
+
+ /* Notice that we destroy the interface and reset the callback information before
+ dispatching the callback so that the callback can generate another request. */
+
+ destroy_listener_interface (shell_component_client);
+
+ priv->listener_servant = NULL;
+ priv->listener_interface = CORBA_OBJECT_NIL;
+
+ callback = priv->callback;
+ callback_data = priv->callback_data;
+
+ priv->callback = NULL;
+ priv->callback_data = NULL;
+
+ (* callback) (shell_component_client, result, callback_data);
+}
+
/* GtkObject methods. */
@@ -306,10 +317,8 @@ impl_destroy (GtkObject *object)
CORBA_Object_release (priv->offline_interface, &ev);
}
- if (priv->listener_interface != CORBA_OBJECT_NIL) {
- CORBA_Object_release (priv->listener_interface, &ev);
- free_ShellComponentListener_servant (priv->listener_servant);
- }
+ if (priv->listener_interface != CORBA_OBJECT_NIL)
+ destroy_listener_interface (shell_component_client);
CORBA_exception_free (&ev);