mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 04:36:17 +01:00
make sure g_set_prgname() gets called only once
* glib/gutils.c: copy the call-once statement from g_set_application_name(); Fixes Bug #563627: g_get_prgname() threadsafety
This commit is contained in:
parent
d105f431b0
commit
3dab24828e
@ -1968,10 +1968,17 @@ g_get_prgname (void)
|
||||
void
|
||||
g_set_prgname (const gchar *prgname)
|
||||
{
|
||||
gboolean already_set = FALSE;
|
||||
|
||||
G_LOCK (g_prgname);
|
||||
g_free (g_prgname);
|
||||
g_prgname = g_strdup (prgname);
|
||||
if (g_prgname)
|
||||
already_set = TRUE;
|
||||
else
|
||||
g_prgname = g_strdup (prgname);
|
||||
G_UNLOCK (g_prgname);
|
||||
|
||||
if (already_set)
|
||||
g_warning ("g_set_prgname() called multiple times");
|
||||
}
|
||||
|
||||
G_LOCK_DEFINE_STATIC (g_application_name);
|
||||
@ -2038,7 +2045,7 @@ g_set_application_name (const gchar *application_name)
|
||||
G_UNLOCK (g_application_name);
|
||||
|
||||
if (already_set)
|
||||
g_warning ("g_set_application() name called multiple times");
|
||||
g_warning ("g_set_application_name() called multiple times");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user