mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
gutils: assert against calling g_set_application_name()
g_set_application_name() guards against being reset, but it doesn't remember whether it was set, it only checks whether g_application_name was set to non-NULL. When allowing g_set_application_name(NULL) that leads to odd behaviors, like: g_set_application_name(NULL); g_set_application_name("foo"); would not warn. Disallow that and assert against a NULL application_name. Note that application_name argument is also not marked as "(nullable)".
This commit is contained in:
parent
167deee94d
commit
0d61895ef1
@ -1232,7 +1232,9 @@ void
|
|||||||
g_set_application_name (const gchar *application_name)
|
g_set_application_name (const gchar *application_name)
|
||||||
{
|
{
|
||||||
gboolean already_set = FALSE;
|
gboolean already_set = FALSE;
|
||||||
|
|
||||||
|
g_return_if_fail (application_name);
|
||||||
|
|
||||||
G_LOCK (g_application_name);
|
G_LOCK (g_application_name);
|
||||||
if (g_application_name)
|
if (g_application_name)
|
||||||
already_set = TRUE;
|
already_set = TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user