[glib/glib-2-32] GTlsInteraction: Fix incorrect locking of mutex
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-32] GTlsInteraction: Fix incorrect locking of mutex
- Date: Sat, 14 Jul 2012 23:22:40 +0000 (UTC)
commit 5bf587caa061aad77d046c170a822c5b1e0624dd
Author: Stef Walter <stefw gnome org>
Date: Thu Jun 28 14:41:39 2012 +0200
GTlsInteraction: Fix incorrect locking of mutex
* Fix incorrect locking of mutex in g_tls_interaction_invoke_ask_password()
https://bugzilla.gnome.org/show_bug.cgi?id=678758
gio/gtlsinteraction.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gio/gtlsinteraction.c b/gio/gtlsinteraction.c
index 41574b7..e921b81 100644
--- a/gio/gtlsinteraction.c
+++ b/gio/gtlsinteraction.c
@@ -321,6 +321,7 @@ g_tls_interaction_invoke_ask_password (GTlsInteraction *interaction,
GTlsInteractionResult result;
InvokeClosure *closure;
GTlsInteractionClass *klass;
+ gboolean complete;
g_return_val_if_fail (G_IS_TLS_INTERACTION (interaction), G_TLS_INTERACTION_UNHANDLED);
g_return_val_if_fail (G_IS_TLS_PASSWORD (password), G_TLS_INTERACTION_UNHANDLED);
@@ -348,12 +349,16 @@ g_tls_interaction_invoke_ask_password (GTlsInteraction *interaction,
*/
if (g_main_context_acquire (interaction->priv->context))
{
- while (!closure->complete)
+ for (;;)
{
+ g_mutex_lock (&closure->mutex);
+ complete = closure->complete;
g_mutex_unlock (&closure->mutex);
+ if (complete)
+ break;
g_main_context_iteration (interaction->priv->context, TRUE);
- g_mutex_lock (&closure->mutex);
}
+
g_main_context_release (interaction->priv->context);
if (closure->error)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]