mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 08:22:16 +01:00 
			
		
		
		
	Fix crash caused by g_network_monitor_base_add_network()
This avoids a crash when starting Evolution, and fixes the network-monitor and network-monitor-race test cases on my developer workstation. (I assume the CI is not crashing due to lack of network access there.) Problem is that if a network already exists in the networks table, g_hash_table_add() "destroys" (unrefs) it before adding the new one (which we failed to ref before adding). This means we just accidentally lost a ref. In practice, the network gets unexpectedly destroyed here before returning. Fixes #2020
This commit is contained in:
		| @@ -496,11 +496,9 @@ void | ||||
| g_network_monitor_base_add_network (GNetworkMonitorBase *monitor, | ||||
|                                     GInetAddressMask    *network) | ||||
| { | ||||
|   if (!g_hash_table_add (monitor->priv->networks, network)) | ||||
|   if (!g_hash_table_add (monitor->priv->networks, g_object_ref (network))) | ||||
|     return; | ||||
|  | ||||
|   g_object_ref (network);  /* for the element now stored in the hash table */ | ||||
|  | ||||
|   if (g_inet_address_mask_get_length (network) == 0) | ||||
|     { | ||||
|       switch (g_inet_address_mask_get_family (network)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user