From: Colin Leroy Date: Tue, 25 Oct 2011 07:22:55 +0000 (+0000) Subject: 2011-10-25 [colin] 3.7.10cvs50 X-Git-Tag: REL_3_8_0~65 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=2a4accc81da5f080fa09b9786f8704d2c1b3cf1f 2011-10-25 [colin] 3.7.10cvs50 * src/compose.c * src/messageview.c * src/procmsg.c * src/procmsg.h Fix locking when sending a single message --- diff --git a/ChangeLog b/ChangeLog index 6d116fea7..c6fda1b84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-10-25 [colin] 3.7.10cvs50 + + * src/compose.c + * src/messageview.c + * src/procmsg.c + * src/procmsg.h + Fix locking when sending a single message + 2011-10-25 [colin] 3.7.10cvs49 * src/gtk/colorlabel.c diff --git a/PATCHSETS b/PATCHSETS index e8bfc3e53..13a9d2b4b 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -4253,3 +4253,4 @@ ( cvs diff -u -r 1.83.2.174 -r 1.83.2.175 src/mimeview.c; ) > 3.7.10cvs47.patchset ( cvs diff -u -r 1.25.2.70 -r 1.25.2.71 src/stock_pixmap.c; ) > 3.7.10cvs48.patchset ( cvs diff -u -r 1.2.2.35 -r 1.2.2.36 src/gtk/colorlabel.c; cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/gtk/gtkcmclist.c; ) > 3.7.10cvs49.patchset +( cvs diff -u -r 1.382.2.587 -r 1.382.2.588 src/compose.c; cvs diff -u -r 1.94.2.220 -r 1.94.2.221 src/messageview.c; cvs diff -u -r 1.150.2.118 -r 1.150.2.119 src/procmsg.c; cvs diff -u -r 1.60.2.56 -r 1.60.2.57 src/procmsg.h; ) > 3.7.10cvs50.patchset diff --git a/configure.ac b/configure.ac index 3217d40e0..5ce382faf 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=7 MICRO_VERSION=10 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=49 +EXTRA_VERSION=50 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/compose.c b/src/compose.c index 0a20d22af..f44abed80 100644 --- a/src/compose.c +++ b/src/compose.c @@ -5003,10 +5003,10 @@ gint compose_send(Compose *compose) } if (msgpath == NULL) { msgpath = folder_item_fetch_msg(folder, msgnum); - val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed); + val = procmsg_send_message_queue_with_lock(msgpath, &errstr, folder, msgnum, &queued_removed); g_free(msgpath); } else { - val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed); + val = procmsg_send_message_queue_with_lock(msgpath, &errstr, folder, msgnum, &queued_removed); claws_unlink(msgpath); g_free(msgpath); } diff --git a/src/messageview.c b/src/messageview.c index b73fd4678..5524362fe 100644 --- a/src/messageview.c +++ b/src/messageview.c @@ -1066,7 +1066,7 @@ static gint disposition_notification_send(MsgInfo *msginfo) /* send it */ path = folder_item_fetch_msg(queue, num); - ok = procmsg_send_message_queue(path, &foo, queue, num, &queued_removed); + ok = procmsg_send_message_queue_with_lock(path, &foo, queue, num, &queued_removed); g_free(path); g_free(foo); if (ok == 0 && !queued_removed) diff --git a/src/procmsg.c b/src/procmsg.c index 30ca024f8..15fea2c27 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -845,6 +845,25 @@ static gboolean procmsg_is_last_for_account(FolderItem *queue, MsgInfo *msginfo, } static gboolean send_queue_lock = FALSE; + +gboolean procmsg_queue_lock(char **errstr) +{ + if (send_queue_lock) { + /* Avoid having to translate two similar strings */ + log_warning(LOG_PROTOCOL, "%s\n", _("Already trying to send.")); + if (errstr) { + if (*errstr) g_free(*errstr); + *errstr = g_strdup_printf(_("Already trying to send.")); + } + return FALSE; + } + send_queue_lock = TRUE; + return TRUE; +} +void procmsg_queue_unlock(void) +{ + send_queue_lock = FALSE; +} /*! *\brief Send messages in queue * @@ -861,23 +880,16 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, gchar **errstr) GSList *sorted_list = NULL; GNode *node, *next; - if (send_queue_lock) { - /* Avoid having to translate two similar strings */ - log_warning(LOG_PROTOCOL, "%s\n", _("Already trying to send.")); - if (errstr) { - if (*errstr) g_free(*errstr); - *errstr = g_strdup_printf(_("Already trying to send.")); - } + if (!procmsg_queue_lock(errstr)) { toolbar_main_set_sensitive(mainwindow_get_mainwindow()); return -1; } - send_queue_lock = TRUE; inc_lock(); if (!queue) queue = folder_get_default_queue(); if (queue == NULL) { - send_queue_lock = FALSE; + procmsg_queue_unlock(); inc_unlock(); return -1; } @@ -937,7 +949,7 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, gchar **errstr) node = next; } } - send_queue_lock = FALSE; + procmsg_queue_unlock(); inc_unlock(); toolbar_main_set_sensitive(mainwindow_get_mainwindow()); @@ -1812,6 +1824,17 @@ gint procmsg_send_message_queue(const gchar *file, gchar **errstr, FolderItem *q return result; } +gint procmsg_send_message_queue_with_lock(const gchar *file, gchar **errstr, FolderItem *queue, gint msgnum, gboolean *queued_removed) +{ + gint val; + if (procmsg_queue_lock(errstr)) { + val = procmsg_send_message_queue(file, errstr, queue, msgnum, queued_removed); + procmsg_queue_unlock(); + return val; + } + return -1; +} + static void update_folder_msg_counts(FolderItem *item, MsgInfo *msginfo, MsgPermFlags old_flags) { MsgPermFlags new_flags = msginfo->flags.perm_flags; diff --git a/src/procmsg.h b/src/procmsg.h index 6b1a8f844..89fd67f51 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -330,6 +330,8 @@ void procmsg_empty_all_trash (void); gint procmsg_send_queue (FolderItem *queue, gboolean save_msgs, gchar **errstr); +gboolean procmsg_queue_lock (gchar **errstr); +void procmsg_queue_unlock (void); gboolean procmsg_queue_is_empty (FolderItem *queue); void procmsg_print_message (MsgInfo *msginfo, const gchar *cmdline); @@ -344,6 +346,12 @@ MsgInfo *procmsg_msginfo_get_full_info_from_file void procmsg_msginfo_free (MsgInfo *msginfo); guint procmsg_msginfo_memusage (MsgInfo *msginfo); +gint procmsg_send_message_queue_with_lock(const gchar *file, + gchar **errstr, + FolderItem *queue, + gint msgnum, + gboolean *queued_removed); + gint procmsg_send_message_queue (const gchar *file, gchar **errstr, FolderItem *queue,