gmenuexporter: synchronization in org_gtk_Menus_get_interface.

Protects the mutation inside org_gtk_Menus_get_interface with
g_once_init_{enter,leave}.

Fixes #3051.
This commit is contained in:
André 2023-08-13 01:21:49 -03:00 committed by Philip Withnall
parent f522c3f94d
commit 572f8ab534

View File

@ -53,8 +53,9 @@ static GDBusInterfaceInfo *
org_gtk_Menus_get_interface (void)
{
static GDBusInterfaceInfo *interface_info;
static gsize interface_info_initialized = 0;
if (interface_info == NULL)
if (g_once_init_enter (&interface_info_initialized))
{
GError *error = NULL;
GDBusNodeInfo *info;
@ -79,6 +80,8 @@ org_gtk_Menus_get_interface (void)
g_assert (interface_info != NULL);
g_dbus_interface_info_ref (interface_info);
g_dbus_node_info_unref (info);
g_once_init_leave (&interface_info_initialized, 1);
}
return interface_info;