From 144cb923ddc5c383cb8db38073686513f3b1afb7 Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Fri, 19 Oct 2001 08:09:22 +0000 Subject: [PATCH] Use another LOCK for g_prgname to avoid deadlocking. (#62606) 2001-10-19 Sebastian Wilhelmi * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK for g_prgname to avoid deadlocking. (#62606) --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/gutils.c | 14 ++++++-------- 9 files changed, 46 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ada843a..6610160 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index ada843a..6610160 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ada843a..6610160 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index ada843a..6610160 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index ada843a..6610160 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ada843a..6610160 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ada843a..6610160 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ada843a..6610160 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2001-10-19 Sebastian Wilhelmi + + * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK + for g_prgname to avoid deadlocking. (#62606) + 2001-10-19 Tor Lillqvist * configure.in: Check also ac_cv_sizeof___int64 when requiring a diff --git a/glib/gutils.c b/glib/gutils.c index b3bfa27..2699544 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -1000,6 +1000,7 @@ g_get_tmp_dir (void) return g_tmp_dir; } +G_LOCK_DEFINE (g_prgname); static gchar *g_prgname = NULL; gchar* @@ -1007,9 +1008,9 @@ g_get_prgname (void) { gchar* retval; - G_LOCK (g_utils_global); + G_LOCK (g_prgname); retval = g_prgname; - G_UNLOCK (g_utils_global); + G_UNLOCK (g_prgname); return retval; } @@ -1017,13 +1018,10 @@ g_get_prgname (void) void g_set_prgname (const gchar *prgname) { - gchar *c; - - G_LOCK (g_utils_global); - c = g_prgname; + G_LOCK (g_prgname); + g_free (g_prgname); g_prgname = g_strdup (prgname); - g_free (c); - G_UNLOCK (g_utils_global); + G_UNLOCK (g_prgname); } guint -- 2.7.4