45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
|
|
From bf7d941088b4860a93f3ea0f3202f495a9fd0667 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Ondrej Holy <oholy@redhat.com>
|
||
|
|
Date: Mon, 19 Feb 2024 13:38:00 +0100
|
||
|
|
Subject: [PATCH] gcontextspecificgroup: Wait until stop_func is done
|
||
|
|
|
||
|
|
Currently, the `stop_func` is executed on an extra thread, and the
|
||
|
|
`g_context_specific_group_remove` function returns before the `stop_func`
|
||
|
|
finishes. It may happen that the `stop_func` is never executed if the
|
||
|
|
program terminates soon after calling it. Let's wait until the `stop_func`
|
||
|
|
is done.
|
||
|
|
|
||
|
|
Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3258
|
||
|
|
---
|
||
|
|
gio/gcontextspecificgroup.c | 14 ++------------
|
||
|
|
1 file changed, 2 insertions(+), 12 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/gio/gcontextspecificgroup.c b/gio/gcontextspecificgroup.c
|
||
|
|
index e1def3bbb..41a35de86 100644
|
||
|
|
--- a/gio/gcontextspecificgroup.c
|
||
|
|
+++ b/gio/gcontextspecificgroup.c
|
||
|
|
@@ -153,18 +153,8 @@ g_context_specific_group_request_state (GContextSpecificGroup *group,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
- /* we only block for positive transitions */
|
||
|
|
- if (requested_state)
|
||
|
|
- {
|
||
|
|
- while (group->requested_state != group->effective_state)
|
||
|
|
- g_cond_wait (&group->cond, &group->lock);
|
||
|
|
-
|
||
|
|
- /* there is no way this could go back to FALSE because the object
|
||
|
|
- * that we just created in this thread would have to have been
|
||
|
|
- * destroyed again (from this thread) before that could happen.
|
||
|
|
- */
|
||
|
|
- g_assert (group->effective_state);
|
||
|
|
- }
|
||
|
|
+ while (group->requested_state != group->effective_state)
|
||
|
|
+ g_cond_wait (&group->cond, &group->lock);
|
||
|
|
}
|
||
|
|
|
||
|
|
gpointer
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|