summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2017-05-23 14:02:28 +0200
committerOndrej Holy <oholy@redhat.com>2017-05-23 14:02:28 +0200
commit0564c9c92ab85b6b73efc1116b223878a5a89626 (patch)
tree979737febce6d96120358ecbd5c13cfaa0d7b243
parent03fbe16aebced70118f070f898d7b459e1125580 (diff)
downloadgvfs-0564c9c92ab85b6b73efc1116b223878a5a89626.tar.gz
client: Use g_cond_wait in a loop
The documentation says that g_cond_wait() must always be used in a loop, but it isn't in some cases. Let's fix it.
-rw-r--r--common/gmountsource.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/gmountsource.c b/common/gmountsource.c
index 702864e4..c5d9f1a3 100644
--- a/common/gmountsource.c
+++ b/common/gmountsource.c
@@ -410,8 +410,9 @@ g_mount_source_ask_password (GMountSource *source,
flags,
ask_reply_sync,
&data);
-
- g_cond_wait (&data.cond, &data.mutex);
+
+ while (data.result == NULL)
+ g_cond_wait (&data.cond, &data.mutex);
g_mutex_unlock (&data.mutex);
g_cond_clear (&data.cond);
@@ -572,8 +573,9 @@ g_mount_source_ask_question (GMountSource *source,
choices,
ask_reply_sync,
&data);
-
- g_cond_wait (&data.cond, &data.mutex);
+
+ while (data.result == NULL)
+ g_cond_wait (&data.cond, &data.mutex);
g_mutex_unlock (&data.mutex);
g_cond_clear (&data.cond);
@@ -843,7 +845,8 @@ g_mount_source_show_processes (GMountSource *source,
ask_reply_sync,
&data);
- g_cond_wait (&data.cond, &data.mutex);
+ while (data.result == NULL)
+ g_cond_wait (&data.cond, &data.mutex);
g_mutex_unlock (&data.mutex);
g_cond_clear (&data.cond);