summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glib-2.0/glib-2.0/0011-GMainContext-Fix-GSource-iterator-if-iteration-can-m.patch
diff options
context:
space:
mode:
authorDaniel Gomez <daniel@qtec.com>2020-04-03 09:20:18 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-04-05 11:46:38 +0100
commit5cd71814ac1f747d6ae858ffb104c571b57b25fd (patch)
tree294e26b11e5d8a94e249e305e301bf3bcdd5c6fd /meta/recipes-core/glib-2.0/glib-2.0/0011-GMainContext-Fix-GSource-iterator-if-iteration-can-m.patch
parentac39c11d4988ced28a8d549068e2e870b4ad90d6 (diff)
downloadpoky-5cd71814ac1f747d6ae858ffb104c571b57b25fd.tar.gz
glib-2.0: Backport GMainContext fixes
Backport fixes introduced in 2.63.6 for memory leaks and memory corruption in GMainContext Upstream merge: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1353 Fixes SIGSEGV in GStreamer: Thread 2 "multihandlesink" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff6bb9700 (LWP 18045)] 0x00007ffff7d65992 in g_source_unref_internal (source=0x7ffff00047d0, context=0x55555561c800, have_lock=1) at ../../../../../../../repo/workspace/sources/glib-2.0/glib/gmain.c:2146 2146 ../../../../../../../repo/workspace/sources/glib-2.0/glib/gmain.c: No such file or directory. (gdb) bt #0 0x00007ffff7d65992 in g_source_unref_internal (source=0x7ffff00047d0, context=0x55555561c800, have_lock=1) at ../../../../../../../repo/workspace/sources/glib-2.0/glib/gmain.c:2146 #1 0x00007ffff7d65bb6 in g_source_iter_next (iter=iter@entry=0x7ffff6bb8db0, source=source@entry=0x7ffff6bb8da8) at ../../../../../../../repo/workspace/sources/glib-2.0/glib/gmain.c:980 #2 0x00007ffff7d67ef3 in g_main_context_prepare (context=context@entry=0x55555561c800, priority=priority@entry=0x7ffff6bb8e30) at ../../../../../../../repo/workspace/sources/glib-2.0/glib/gmain.c:944 #3 0x00007ffff7d6896b in g_main_context_iterate (context=context@entry=0x55555561c800, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../../../../../repo/workspace/sources/glib-2.0/glib/gmain.c:3900 #4 0x00007ffff7d68b4c in g_main_context_iteration (context=0x55555561c800, may_block=may_block@entry=1) at ../../../../../../../repo/workspace/sources/glib-2.0/glib/gmain.c:3981 #5 0x00007ffff6be4482 in gst_multi_socket_sink_thread (mhsink=0x555555679ab0 [GstMultiSocketSink]) at ../../../gst-plugins-base-1.14.4/gst/tcp/gstmultisocketsink.c:1164 #6 0x00007ffff7d8fb35 in g_thread_proxy (data=0x55555565c770) at ../../../../../../../repo/workspace/sources/glib-2.0/glib/gthread.c:784 #7 0x00007ffff7841ebd in start_thread (arg=<optimized out>) at pthread_create.c:486 #8 0x00007ffff7aa12bf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 #8 0x00007ffff7aa12bf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (From OE-Core rev: 62eb45e6455df99b0c8b61bfb90858bb656bd724) Signed-off-by: Daniel Gomez <daniel@qtec.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glib-2.0/glib-2.0/0011-GMainContext-Fix-GSource-iterator-if-iteration-can-m.patch')
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0011-GMainContext-Fix-GSource-iterator-if-iteration-can-m.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0011-GMainContext-Fix-GSource-iterator-if-iteration-can-m.patch b/meta/recipes-core/glib-2.0/glib-2.0/0011-GMainContext-Fix-GSource-iterator-if-iteration-can-m.patch
new file mode 100644
index 0000000000..37b77d567c
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0011-GMainContext-Fix-GSource-iterator-if-iteration-can-m.patch
@@ -0,0 +1,43 @@
1From ef2be42998e3fc10299055a5a01f7c791538174c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
3Date: Mon, 3 Feb 2020 15:38:28 +0200
4Subject: [PATCH] GMainContext - Fix GSource iterator if iteration can modify
5 the list
6
7We first have to ref the next source and then unref the previous one.
8This might be the last reference to the previous source, and freeing the
9previous source might unref and free the next one which would then leave
10use with a dangling pointer here.
11
12Fixes https://gitlab.gnome.org/GNOME/glib/issues/2031
13
14Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/b06c48de7554607ff3fb58d6c0510cfa5088e909]
15
16---
17 glib/gmain.c | 8 ++++++--
18 1 file changed, 6 insertions(+), 2 deletions(-)
19
20diff --git a/glib/gmain.c b/glib/gmain.c
21index af979c8..a9a287d 100644
22--- a/glib/gmain.c
23+++ b/glib/gmain.c
24@@ -969,13 +969,17 @@ g_source_iter_next (GSourceIter *iter, GSource **source)
25 * GSourceList to be removed from source_lists (if iter->source is
26 * the only source in its list, and it is destroyed), so we have to
27 * keep it reffed until after we advance iter->current_list, above.
28+ *
29+ * Also we first have to ref the next source before unreffing the
30+ * previous one as unreffing the previous source can potentially
31+ * free the next one.
32 */
33+ if (next_source && iter->may_modify)
34+ g_source_ref (next_source);
35
36 if (iter->source && iter->may_modify)
37 g_source_unref_internal (iter->source, iter->context, TRUE);
38 iter->source = next_source;
39- if (iter->source && iter->may_modify)
40- g_source_ref (iter->source);
41
42 *source = iter->source;
43 return *source != NULL;