[Commits] [SCM] claws branch, gtk3tree, updated. 4.0.0-395-gc134d0648

paul at claws-mail.org paul at claws-mail.org
Wed Nov 3 11:30:59 UTC 2021


The branch, gtk3tree has been updated
       via  c134d0648710e3cb1a6d2403561590dbc2e3d652 (commit)
      from  e72048ce5ef93ab7552098a8c05d9bf4b05020de (commit)

Summary of changes:
 src/common/utils.c  | 11 -----------
 src/common/utils.h  |  3 ---
 src/compose.c       | 22 +++++++++++-----------
 src/compose.h       |  2 +-
 src/prefs_account.c | 26 ++++++++++++--------------
 5 files changed, 24 insertions(+), 40 deletions(-)


- Log -----------------------------------------------------------------
commit c134d0648710e3cb1a6d2403561590dbc2e3d652
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 27 01:37:12 2021 -0700

    Remove cm_mutex_new/_free wrappers

diff --git a/src/common/utils.c b/src/common/utils.c
index 73c90393a..f741c62d5 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -4441,17 +4441,6 @@ size_t fast_strftime(gchar *buf, gint buflen, const gchar *format, struct tm *lt
 #define WEXITSTATUS(x) (x)
 #endif
 
-GMutex *cm_mutex_new(void) {
-	GMutex *m = g_new0(GMutex, 1);
-	g_mutex_init(m);
-	return m;
-}
-
-void cm_mutex_free(GMutex *mutex) {
-	g_mutex_clear(mutex);
-	g_free(mutex);
-}
-
 static gchar *canonical_list_to_file(GSList *list)
 {
 	GString *result = g_string_new(NULL);
diff --git a/src/common/utils.h b/src/common/utils.h
index f908114e3..7b8ed25ac 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -524,9 +524,6 @@ gboolean file_is_email(const gchar *filename);
 gboolean sc_g_list_bigger(GList *list, gint max);
 gboolean sc_g_slist_bigger(GSList *list, gint max);
 
-GMutex *cm_mutex_new(void);
-void cm_mutex_free(GMutex *mutex);
-
 int cm_canonicalize_filename(const gchar *filename, gchar **canonical_name);
 
 guchar *g_base64_decode_zero(const gchar *text, gsize *out_len);
diff --git a/src/compose.c b/src/compose.c
index 4358eff0b..f8b5262f7 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -7795,7 +7795,7 @@ static Compose *compose_create(PrefsAccount *account,
 	compose->account = account;
 	compose->folder = folder;
 	
-	compose->mutex = cm_mutex_new();
+	g_mutex_init(&compose->mutex);
 	compose->set_cursor_pos = -1;
 
 	window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "compose");
@@ -9212,7 +9212,7 @@ static void compose_destroy(Compose *compose)
 	gtk_widget_destroy(compose->window);
 	toolbar_destroy(compose->toolbar);
 	g_free(compose->toolbar);
-	cm_mutex_free(compose->mutex);
+	g_mutex_clear(&compose->mutex);
 	g_free(compose);
 }
 
@@ -10288,7 +10288,7 @@ gboolean compose_draft (gpointer data, guint action)
 	draft = account_get_special_folder(compose->account, F_DRAFT);
 	cm_return_val_if_fail(draft != NULL, FALSE);
 	
-	if (!g_mutex_trylock(compose->mutex)) {
+	if (!g_mutex_trylock(&compose->mutex)) {
 		/* we don't want to lock the mutex once it's available,
 		 * because as the only other part of compose.c locking
 		 * it is compose_close - which means once unlocked,
@@ -10429,12 +10429,12 @@ warn_err:
 					  FALSE, NULL, ALERT_QUESTION);
 				if (val == G_ALERTALTERNATE) {
 					lock = FALSE;
-					g_mutex_unlock(compose->mutex); /* must be done before closing */
+					g_mutex_unlock(&compose->mutex); /* must be done before closing */
 					compose_close(compose);
 					return TRUE;
 				} else {
 					lock = FALSE;
-					g_mutex_unlock(compose->mutex); /* must be done before closing */
+					g_mutex_unlock(&compose->mutex); /* must be done before closing */
 					return FALSE;
 				}
 			}
@@ -10469,7 +10469,7 @@ warn_err:
 	
 	if (action == COMPOSE_QUIT_EDITING || action == COMPOSE_DRAFT_FOR_EXIT) {
 		lock = FALSE;
-		g_mutex_unlock(compose->mutex); /* must be done before closing */
+		g_mutex_unlock(&compose->mutex); /* must be done before closing */
 		compose_close(compose);
 		return TRUE;
 	} else {
@@ -10535,7 +10535,7 @@ warn_err:
 	}
 unlock:
 	lock = FALSE;
-	g_mutex_unlock(compose->mutex);
+	g_mutex_unlock(&compose->mutex);
 	return TRUE;
 }
 
@@ -10712,7 +10712,7 @@ static void compose_close_cb(GtkAction *action, gpointer data)
 
 	if (compose->modified) {
 		gboolean reedit = (compose->rmode == COMPOSE_REEDIT);
-		if (!g_mutex_trylock(compose->mutex)) {
+		if (!g_mutex_trylock(&compose->mutex)) {
 			/* we don't want to lock the mutex once it's available,
 			 * because as the only other part of compose.c locking
 			 * it is compose_close - which means once unlocked,
@@ -10731,7 +10731,7 @@ static void compose_close_cb(GtkAction *action, gpointer data)
 				 _("_Don't save"), _("_Save to Drafts"), _("_Cancel"),
 				 ALERTFOCUS_SECOND);
 		}
-		g_mutex_unlock(compose->mutex);
+		g_mutex_unlock(&compose->mutex);
 		switch (val) {
 		case G_ALERTDEFAULT:
 			if (compose_can_autosave(compose) && !reedit)
@@ -12094,7 +12094,7 @@ gboolean compose_close(Compose *compose)
 
 	cm_return_val_if_fail(compose, FALSE);
 
-	if (!g_mutex_trylock(compose->mutex)) {
+	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. */
@@ -12118,7 +12118,7 @@ gboolean compose_close(Compose *compose)
 		prefs_common.compose_x = x;
 		prefs_common.compose_y = y;
 	}
-	g_mutex_unlock(compose->mutex);
+	g_mutex_unlock(&compose->mutex);
 	compose_destroy(compose);
 	return FALSE;
 }
diff --git a/src/compose.h b/src/compose.h
index 011da35b0..0da46906b 100644
--- a/src/compose.h
+++ b/src/compose.h
@@ -244,7 +244,7 @@ struct _Compose
 	GtkTextTag *uri_tag;
 
 	gboolean automatic_break;
-	GMutex *mutex;
+	GMutex mutex;
 	gint close_timeout_tag;
 	gchar *orig_charset;
 	gint set_cursor_pos;
diff --git a/src/prefs_account.c b/src/prefs_account.c
index 991969a22..76d8351d0 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -4209,8 +4209,8 @@ static gboolean sslcert_get_client_cert_hook(gpointer source, gpointer data)
 }
 
 struct GetPassData {
-	GCond *cond;
-	GMutex* mutex;
+	GCond cond;
+	GMutex mutex;
 	gchar **pass;
 };
 
@@ -4218,30 +4218,28 @@ struct GetPassData {
 static gboolean do_get_pass(gpointer data)
 {
 	struct GetPassData *pass_data = (struct GetPassData *)data;
-	g_mutex_lock(pass_data->mutex);
+	g_mutex_lock(&pass_data->mutex);
 	*(pass_data->pass) = input_dialog_query_password("the PKCS12 client certificate", NULL);
-	g_cond_signal(pass_data->cond);
-	g_mutex_unlock(pass_data->mutex);
+	g_cond_signal(&pass_data->cond);
+	g_mutex_unlock(&pass_data->mutex);
 	return FALSE;
 }
 static gboolean sslcert_get_password(gpointer source, gpointer data)
 { 
 	struct GetPassData pass_data;
 	/* do complicated stuff to be able to call GTK from the mainloop */
-	pass_data.cond = g_new0(GCond, 1);
-	g_cond_init(pass_data.cond);
-	pass_data.mutex = cm_mutex_new();
+	g_cond_init(&pass_data.cond);
+	g_mutex_init(&pass_data.mutex);
 	pass_data.pass = (gchar **)source;
 
-	g_mutex_lock(pass_data.mutex);
+	g_mutex_lock(&pass_data.mutex);
 
 	g_idle_add(do_get_pass, &pass_data);
 
-	g_cond_wait(pass_data.cond, pass_data.mutex);
-	g_cond_clear(pass_data.cond);
-	g_free(pass_data.cond);
-	g_mutex_unlock(pass_data.mutex);
-	cm_mutex_free(pass_data.mutex);
+	g_cond_wait(&pass_data.cond, &pass_data.mutex);
+	g_cond_clear(&pass_data.cond);
+	g_mutex_unlock(&pass_data.mutex);
+	g_mutex_clear(&pass_data.mutex);
 
 	return TRUE;
 }

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list