blob: 4c9e9f51825301dc0e349cab4f1fc6d2ec9a4430 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From 3e9d85f1b75e2b1096d9643563d7d17380752fc7 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
3Date: Tue, 11 Feb 2020 09:34:38 +0200
4Subject: [PATCH] GMainContext - Move mutex unlocking in destructor right
5 before freeing the mutex
6
7This does not have any behaviour changes but is cleaner. The mutex is
8only unlocked now after all operations on the context are done and right
9before freeing the mutex and the context itself.
10
11Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/730a75fc8e8271c38fbd5363d1f77a00876b9ddc]
12
13---
14 glib/gmain.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/glib/gmain.c b/glib/gmain.c
18index 10ba2f8..b1df470 100644
19--- a/glib/gmain.c
20+++ b/glib/gmain.c
21@@ -584,7 +584,6 @@ g_main_context_unref (GMainContext *context)
22 source = s_iter->data;
23 g_source_destroy_internal (source, context, TRUE);
24 }
25- UNLOCK_CONTEXT (context);
26
27 for (sl_iter = context->source_lists; sl_iter; sl_iter = sl_iter->next)
28 {
29@@ -595,6 +594,7 @@ g_main_context_unref (GMainContext *context)
30
31 g_hash_table_destroy (context->sources);
32
33+ UNLOCK_CONTEXT (context);
34 g_mutex_clear (&context->mutex);
35
36 g_ptr_array_free (context->pending_dispatches, TRUE);