mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-23 10:27:51 +02:00
Use another LOCK for g_prgname to avoid deadlocking. (#62606)
2001-10-19 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * glib/gutils.c (g_set_prgname, g_get_prgname): Use another LOCK for g_prgname to avoid deadlocking. (#62606)
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
73c99a0f64
commit
144cb923dd
@@ -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
|
||||
|
Reference in New Issue
Block a user