diff options
author | Tim Janik <timj@imendio.com> | 2007-08-13 12:18:55 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2007-08-13 12:18:55 +0000 |
commit | 8aa559d72f096f172a480ea2cc7a0ab54a58185d (patch) | |
tree | 9c777208c6ec05d76f965bdaa011050d33ba74ef /glib | |
parent | 145e79fb4a4328053f619ea1243c0fc0ddb56571 (diff) | |
download | glib-8aa559d72f096f172a480ea2cc7a0ab54a58185d.tar.gz |
prevent linking a freed GThread structure into global thread list in error
Mon Aug 13 14:18:22 2007 Tim Janik <timj@imendio.com>
* glib/gthread.c (g_thread_create_full): prevent linking a freed
GThread structure into global thread list in error cases.
svn path=/trunk/; revision=5697
Diffstat (limited to 'glib')
-rw-r--r-- | glib/gthread.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/glib/gthread.c b/glib/gthread.c index fe9f25d9a..5468e596f 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -579,7 +579,7 @@ g_thread_cleanup (gpointer data) /* Just to make sure, this isn't used any more */ g_system_thread_assign (thread->system_thread, zero_thread); - g_free (thread); + g_free (thread); } } } @@ -662,8 +662,11 @@ g_thread_create_full (GThreadFunc func, G_THREAD_UF (thread_create, (g_thread_create_proxy, result, stack_size, joinable, bound, priority, &result->system_thread, &local_error)); - result->next = g_thread_all_threads; - g_thread_all_threads = result; + if (!local_error) + { + result->next = g_thread_all_threads; + g_thread_all_threads = result; + } G_UNLOCK (g_thread); if (local_error) |