{
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 ();
info->callback (info->mail_op, info->msg, info->userdata);
gdk_threads_leave ();
+
g_object_unref (info->mail_op);
if (info->msg)
g_object_unref (info->msg);
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
g_signal_emit (G_OBJECT (mail_op), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
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
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 ();
/* It does not matter if the time is not exactly the same than
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 ();
idle_info->callback (idle_info->mail_op,
idle_info->new_headers,
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
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
/* 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 ();
helper->user_callback (priv->source, helper->user_data);
gdk_threads_leave ();
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
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
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 ();
info->notify (info->user_data);
gdk_threads_leave ();
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
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
/* 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 ();
helper->user_callback (priv->source, helper->user_data);
gdk_threads_leave ();
self = helper->mail_op;
priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
+ g_return_if_fail(priv!=NULL);
+
if (*error) {
priv->error = g_error_copy (*error);
priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
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 ();
helper->user_callback (self, folder, helper->user_data);
gdk_threads_leave ();
/* Notify about operation end */
modest_mail_operation_notify_end (self);
+ g_object_unref(self);
}
static void
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
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
/* Create the helper */
helper = g_slice_new0 (RefreshAsyncHelper);
- helper->mail_op = self;
+ helper->mail_op = g_object_ref(self);
helper->user_callback = user_callback;
helper->user_data = user_data;