[Commits] [SCM] claws branch, master, updated. 3.9.3-127-g8880d1a

colin at claws-mail.org colin at claws-mail.org
Wed Apr 30 22:49:10 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  8880d1a9996875e5cb872509de1d47c22e0b9b04 (commit)
      from  408a4be23469ffb9998c30c4e2282b4bd1541e08 (commit)


- Log -----------------------------------------------------------------
commit 8880d1a9996875e5cb872509de1d47c22e0b9b04
Author: Colin Leroy <colin at colino.net>
Date:   Wed Apr 30 22:48:13 2014 +0200

    Fix bug #2398, "Race when closing compose during drafting"
    Thanks to Michael Schwendt for spotting the problem.

diff --git a/src/compose.c b/src/compose.c
index 41f0554..6f4c8b9 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -11453,16 +11453,28 @@ gboolean compose_close(Compose *compose)
 {
 	gint x, y;
 
+	cm_return_val_if_fail(compose, FALSE);
+
 	if (!g_mutex_trylock(compose->mutex)) {
 		/* we have to wait for the (possibly deferred by auto-save)
 		 * drafting to be done, before destroying the compose under
 		 * it. */
 		debug_print("waiting for drafting to finish...\n");
 		compose_allow_user_actions(compose, FALSE);
-		g_timeout_add (500, (GSourceFunc) compose_close, compose);
+		if (compose->close_timeout_tag == 0) {
+			compose->close_timeout_tag = 
+				g_timeout_add (500, (GSourceFunc) compose_close,
+				compose);
+		}
 		return FALSE;
 	}
-	cm_return_val_if_fail(compose, FALSE);
+	
+	if (compose->close_timeout_tag) {
+		/* let the close be done by the deferred callback */
+		g_mutex_unlock(compose->mutex);
+		return FALSE;
+	}
+
 	gtkut_widget_get_uposition(compose->window, &x, &y);
 	if (!compose->batch) {
 		prefs_common.compose_x = x;
diff --git a/src/compose.h b/src/compose.h
index 992989b..2d08a3b 100644
--- a/src/compose.h
+++ b/src/compose.h
@@ -235,6 +235,7 @@ struct _Compose
 
 	gboolean automatic_break;
 	GMutex *mutex;
+	gint close_timeout_tag;
 	gchar *orig_charset;
 	gint set_cursor_pos;
 	

-----------------------------------------------------------------------

Summary of changes:
 src/compose.c |   16 ++++++++++++++--
 src/compose.h |    1 +
 2 files changed, 15 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list