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
parent 65e7a10d2a
commit 5fb89dd597
No known key found for this signature in database
GPG Key ID: F5FAA24B0A69C037

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;