Merge branch 'mcatanzaro/#2020' into 'master'

Fix crash caused by g_network_monitor_base_add_network()

Closes #2020

See merge request GNOME/glib!1343
This commit is contained in:
Philip Withnall 2020-01-31 12:15:20 +00:00
commit 5941bfa49c

View File

@ -496,11 +496,9 @@ void
g_network_monitor_base_add_network (GNetworkMonitorBase *monitor, g_network_monitor_base_add_network (GNetworkMonitorBase *monitor,
GInetAddressMask *network) GInetAddressMask *network)
{ {
if (!g_hash_table_add (monitor->priv->networks, network)) if (!g_hash_table_add (monitor->priv->networks, g_object_ref (network)))
return; return;
g_object_ref (network); /* for the element now stored in the hash table */
if (g_inet_address_mask_get_length (network) == 0) if (g_inet_address_mask_get_length (network) == 0)
{ {
switch (g_inet_address_mask_get_family (network)) switch (g_inet_address_mask_get_family (network))