} else {
tny_folder_add_msg (folder, msg, NULL); /* TODO: check err */
- gdk_threads_enter ();
+
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
ModestWindow *win = modest_msg_edit_window_new (msg, account_name, FALSE);
modest_window_mgr_register_window (modest_runtime_get_window_mgr (), win);
gtk_widget_show_all (GTK_WIDGET (win));
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
g_object_unref (G_OBJECT(folder));
g_object_unref (win);
tny_folder_add_msg (folder, msg, NULL); /* TODO: check err */
- gdk_threads_enter ();
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
ModestWindow *win = modest_msg_edit_window_new (msg, account_name, FALSE);
modest_window_mgr_register_window (modest_runtime_get_window_mgr (), win);
gtk_widget_show_all (GTK_WIDGET (win));
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
g_object_unref (G_OBJECT(folder));
g_object_unref (win);
msg_uid = modest_tny_folder_get_header_unique_id(header);
win_mgr = modest_runtime_get_window_mgr ();
-
- gdk_threads_enter ();
+
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
gboolean already_opened = FALSE;
ModestWindow *msg_view = NULL;
gtk_widget_show_all (GTK_WIDGET (msg_view));
}
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
g_object_unref (header);
g_object_unref (account);
error = NULL;
res = OSSO_OK;
- gdk_threads_enter ();
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
ModestWindow *win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
modest_do_message_delete (header, win);
modest_ui_actions_refresh_message_window_after_delete (MODEST_MSG_VIEW_WINDOW (msg_view));
}
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
if (header)
g_object_unref (header);
{
ModestWindow *win;
- gdk_threads_enter ();
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
/* Pick the main window if it exists */
win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
/* TODO: check the auto-update parameter in the configuration */
modest_ui_actions_do_send_receive_all (win);
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_open_default_inbox(gpointer user_data)
{
- gdk_threads_enter ();
+
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
ModestWindow *win =
modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
MODEST_WIDGET_TYPE_FOLDER_VIEW);
modest_folder_view_select_first_inbox_or_local (MODEST_FOLDER_VIEW (folder_view));
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
/* This D-Bus method is obviously meant to result in the UI being visible,
* so show it, by calling this idle handler directly: */
static gboolean on_idle_top_application (gpointer user_data)
{
- gdk_threads_enter ();
+
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
ModestWindow *win =
modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
gtk_window_present (GTK_WINDOW (win));
}
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
return FALSE; /* Do not call this callback again. */
}
{
CreateMsgIdleInfo *info = (CreateMsgIdleInfo *) idle_data;
- /* GDK LOCK: this one is here because we call this from a thread */
- /* callback could be 'send mail' or 'save to draft'; i dont knonw */
- /* why these tow operations must serialized, i think it could be */
- /* removed */
- gdk_threads_enter ();
+ /* This is a GDK lock because we are an idle callback and
+ * info->callback can contain Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
info->callback (info->mail_op, info->msg, info->userdata);
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
g_object_unref (info->mail_op);
if (info->msg)
ModestMailOperationState *state;
state = modest_mail_operation_clone_state (mail_op);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- /* GDK LOCK: this one is here because we call this from a thread */
- /* However, refresh_account operations call async operations on */
- /* on tinymail, which also emmit 'progress-changed' signal. This */
- /* may be is required to serialize executions of progress-changed'*/
- /* signal handlers. */
- gdk_threads_enter ();
-#endif
+
+ /* This is a GDK lock because we are an idle callback and
+ * the handlers of this signal can contain Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
g_signal_emit (G_OBJECT (mail_op), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- gdk_threads_leave ();
-#endif
+ gdk_threads_leave (); /* CHECKED */
+
g_slice_free (ModestMailOperationState, state);
return TRUE;
pair = (ModestPair *) data;
- /* GDK LOCK: this one is here because we call this from a thread */
- /* However, refresh_account operations call async operations on */
- /* on tinymail, which also emmit 'progress-changed' signal. This */
- /* may be is required to serialize executions of progress-changed'*/
- /* signal handlers */
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- gdk_threads_enter ();
-#endif
+ /* This is a GDK lock because we are an idle callback and
+ * the handlers of this signal can contain Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
g_signal_emit (G_OBJECT (pair->first), signals[PROGRESS_CHANGED_SIGNAL], 0, pair->second, NULL);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- gdk_threads_leave ();
-#endif
+ gdk_threads_leave (); /* CHECKED */
/* Free the state and the reference to the mail operation */
g_slice_free (ModestMailOperationState, (ModestMailOperationState*)pair->second);
static gboolean
set_last_updated_idle (gpointer data)
{
- /* GDK LOCK: this one is here because we call this from a thread */
- /* and executed with g_idle_add_full during process of method */
- /* update_account_thread, to serialize access to LAST_UPDATED */
- /* property of each account */
- gdk_threads_enter ();
+
+ /* This is a GDK lock because we are an idle callback and
+ * modest_account_mgr_set_int can contain Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED - please recheck */
/* It does not matter if the time is not exactly the same than
the time when this idle was called, it's just an
approximation and it won't be very different */
+
modest_account_mgr_set_int (modest_runtime_get_account_mgr (),
(gchar *) data,
MODEST_ACCOUNT_LAST_UPDATED,
time(NULL),
TRUE);
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED - please recheck */
return FALSE;
}
idle_info = (UpdateAccountInfo *) data;
- /* GDK LOCK: this one is here because we call this from a thread */
- /* and executed with g_idle_add during update_account_thread, to */
- /* serialize the execution of refresh user callback (mainloop) */
- /* received as parameter in modest_mail_operation_update_account */
- gdk_threads_enter ();
+ /* This is a GDK lock because we are an idle callback and
+ * idle_info->callback can contain Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
idle_info->callback (idle_info->mail_op,
idle_info->new_headers,
idle_info->user_data);
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
/* Frees */
g_object_unref (idle_info->mail_op);
priv->total = status->of_total;
state = modest_mail_operation_clone_state (self);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- /* GDK LOCK: this one is here because we call this from a thread */
- /* However, refresh_account operations call async operations on */
- /* on tinymail, which also emmit 'progress-changed' signal. This */
- /* may be is required to serialize executions of progress-changed'*/
- /* signal handlers. */
- gdk_threads_enter ();
-#endif
+
+ /* This is not a GDK lock because we are a Tinymail callback
+ * which is already GDK locked by Tinymail */
+
+ /* no gdk_threads_enter (), CHECKED */
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- gdk_threads_leave ();
-#endif
+ /* no gdk_threads_leave (), CHECKED */
+
g_slice_free (ModestMailOperationState, state);
}
/* If user defined callback function was defined, call it */
if (helper->user_callback) {
- /* GDK LOCK: I think this one can be removed if Tinymail */
- /* wraps the lock itself. */
- /* This function is called as idle in tinymail. */
- gdk_threads_enter ();
+
+ /* This is not a GDK lock because we are a Tinymail callback
+ * which is already GDK locked by Tinymail */
+
+ /* no gdk_threads_enter (), CHECKED */
helper->user_callback (priv->source, helper->user_data);
- gdk_threads_leave ();
+ /* no gdk_threads_leave () , CHECKED */
}
/* Free */
/* If user defined callback function was defined, call it even
if the operation failed*/
if (helper->user_callback) {
- /* This callback is called into an iddle by tinymail,
- and idles are not in the main lock */
- gdk_threads_enter ();
+ /* This is not a GDK lock because we are a Tinymail callback
+ * which is already GDK locked by Tinymail */
+
+ /* no gdk_threads_enter (), CHECKED */
helper->user_callback (self, helper->header, msg, helper->user_data);
- gdk_threads_leave ();
+ /* no gdk_threads_leave (), CHECKED */
}
/* Notify about operation end */
state = modest_mail_operation_clone_state (self);
state->bytes_done = status->position;
state->bytes_total = status->of_total;
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- /* GDK LOCK: this one is here because we call this from a thread */
- /* However, refresh_account operations call async operations on */
- /* on tinymail, which also emmit 'progress-changed' signal. This */
- /* may be is required to serialize executions of progress-changed'*/
- /* signal handlers. */
- gdk_threads_enter ();
-#endif
+
+ /* This is not a GDK lock because we are a Tinymail callback
+ * which is already GDK locked by Tinymail */
+
+ /* no gdk_threads_enter (), CHECKED */
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- gdk_threads_leave ();
-#endif
+ /* no gdk_threads_leave (), CHECKED */
+
g_slice_free (ModestMailOperationState, state);
}
info = (NotifyGetMsgsInfo *) data;
- /* Call the user callback. Idles are not in the main lock, so
- lock it */
- gdk_threads_enter ();
+ /* This is a GDK lock because we are an idle callback and
+ * because info->user_callback can contain Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
info->user_callback (info->mail_op, info->header, info->msg, info->user_data);
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
g_slice_free (NotifyGetMsgsInfo, info);
info = (GetFullMsgsInfo *) data;
if (info->notify) {
- /* GDK LOCK: this one is here because we call this from */
- /* a thread. */
- /* It's used to free user_data, like pasted attachments */
- gdk_threads_enter ();
+
+ /* This is a GDK lock because we are an idle callback and
+ * because info->notify can contain Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
info->notify (info->user_data);
- gdk_threads_leave ();
+ gdk_threads_leave (); /* CHECKED */
}
/* free */
priv->total = status->of_total;
state = modest_mail_operation_clone_state (self);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- /* GDK LOCK: this one is here because we call this from a thread */
- /* However, refresh_account operations call async operations on */
- /* on tinymail, which also emmit 'progress-changed' signal. This */
- /* may be is required to serialize executions of progress-changed'*/
- /* signal handlers. */
- gdk_threads_enter ();
-#endif
+
+ /* This is not a GDK lock because we are a Tinymail callback and
+ * Tinymail already acquires the Gdk lock */
+
+ /* no gdk_threads_enter (), CHECKED */
+
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- gdk_threads_leave ();
-#endif
+
+ /* no gdk_threads_leave (), CHECKED */
+
g_slice_free (ModestMailOperationState, state);
}
/* If user defined callback function was defined, call it */
if (helper->user_callback) {
- /* GDK LOCK: I think this one can be removed if Tinymail */
- /* wraps the lock itself. */
- /* This function is called as idle in tinymail. */
- gdk_threads_enter ();
+ /* This is not a GDK lock because we are a Tinymail callback and
+ * Tinymail already acquires the Gdk lock */
+
+ /* no gdk_threads_enter (), CHECKED */
helper->user_callback (priv->source, helper->user_data);
- gdk_threads_leave ();
+ /* no gdk_threads_leave (), CHECKED */
}
/* Free */
out:
/* Call user defined callback, if it exists */
if (helper->user_callback) {
- /* GDK LOCK: I think this one can be removed if Tinymail */
- /* wraps the lock itself. */
- /* This function is called as idle in tinymail. */
- gdk_threads_enter ();
+
+ /* This is not a GDK lock because we are a Tinymail callback and
+ * Tinymail already acquires the Gdk lock */
+
+ /* no gdk_threads_enter (), CHECKED */
helper->user_callback (self, folder, helper->user_data);
- gdk_threads_leave ();
+ /* no gdk_threads_leave (), CHECKED */
}
/* Free */
priv->total = status->of_total;
state = modest_mail_operation_clone_state (self);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- /* GDK LOCK: this one is here because we call this from a thread */
- /* However, refresh_account operations call async operations on */
- /* on tinymail, which also emmit 'progress-changed' signal. This */
- /* may be is required to serialize executions of progress-changed'*/
- /* signal handlers. */
- gdk_threads_enter ();
-#endif
+
+ /* This is not a GDK lock because we are a Tinymail callback and
+ * Tinymail already acquires the Gdk lock */
+
+ /* no gdk_threads_enter (), CHECKED */
+
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
-#ifdef TINYMAIL_IDLES_NOT_LOCKED_YET
- gdk_threads_leave ();
-#endif
+
+ /* no gdk_threads_leave (), CHECKED */
+
g_slice_free (ModestMailOperationState, state);
}