mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
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:
parent
65e7a10d2a
commit
5fb89dd597
@ -53,8 +53,9 @@ static GDBusInterfaceInfo *
|
|||||||
org_gtk_Menus_get_interface (void)
|
org_gtk_Menus_get_interface (void)
|
||||||
{
|
{
|
||||||
static GDBusInterfaceInfo *interface_info;
|
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;
|
GError *error = NULL;
|
||||||
GDBusNodeInfo *info;
|
GDBusNodeInfo *info;
|
||||||
@ -79,6 +80,8 @@ org_gtk_Menus_get_interface (void)
|
|||||||
g_assert (interface_info != NULL);
|
g_assert (interface_info != NULL);
|
||||||
g_dbus_interface_info_ref (interface_info);
|
g_dbus_interface_info_ref (interface_info);
|
||||||
g_dbus_node_info_unref (info);
|
g_dbus_node_info_unref (info);
|
||||||
|
|
||||||
|
g_once_init_leave (&interface_info_initialized, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return interface_info;
|
return interface_info;
|
||||||
|
Loading…
Reference in New Issue
Block a user