[seed] SeedEngine: add missing pthread_key_create
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] SeedEngine: add missing pthread_key_create
- Date: Thu, 7 Feb 2013 07:24:07 +0000 (UTC)
commit 9632daec1ad6c5f52ca44d09591bf59034a9f7b2
Author: Alban Crequy <alban crequy collabora co uk>
Date: Fri Jan 25 16:53:56 2013 +0000
SeedEngine: add missing pthread_key_create
libseed has 6 different init functions; some of them are calling
pthread_key_create() correctly, but some don't. This patch factorizes the call
to pthread_key_create() so it is correctly called whatever the init function
used.
The bug was found when testing seed_init_with_context_and_group(). Symptoms:
when creating a GObject, memory corruption and segfault in
thread_memory_swap_magazines().
libseed/seed-engine.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 27419cc..7165b11 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1715,6 +1715,8 @@ seed_init_constrained_with_context_and_group (gint * argc,
qprototype = g_quark_from_static_string ("js-prototype");
js_ref_quark = g_quark_from_static_string ("js-ref");
+ pthread_key_create(&seed_next_gobject_wrapper_key, NULL);
+
eng = (SeedEngine *) g_malloc (sizeof (SeedEngine));
context_group = group;
@@ -1842,7 +1844,6 @@ SeedEngine *
seed_init (gint * argc, gchar *** argv)
{
context_group = JSContextGroupCreate ();
- pthread_key_create(&seed_next_gobject_wrapper_key, NULL);
return seed_init_with_context_group (argc, argv, context_group);
}
@@ -1866,7 +1867,6 @@ SeedEngine *
seed_init_with_context (gint * argc, gchar *** argv, JSGlobalContextRef context)
{
context_group = JSContextGroupCreate ();
- pthread_key_create(&seed_next_gobject_wrapper_key, NULL);
return seed_init_with_context_and_group (argc, argv, context, context_group);
}
@@ -1896,7 +1896,6 @@ SeedEngine *
seed_init_constrained (gint * argc, gchar *** argv)
{
context_group = JSContextGroupCreate ();
- pthread_key_create(&seed_next_gobject_wrapper_key, NULL);
return seed_init_constrained_with_context_and_group(argc, argv,
JSGlobalContextCreateInGroup (context_group, NULL),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]