[PATCH] Fix crash of nm-system-settings in add_default_dhcp_connection



  	Fix crash of nm-system-settings in add_default_dhcp_connection when wired 
          device gets removed. 
  
  	* system-settings/src/main.c: 
  		- (add_default_dhcp_connection,device_removed_cb): 
  			passing the "key" instead of the value as second argument 
  			to g_hash_table_remove calls helps. 


Here the crash:

...
#6  0x0000000000407e35 in get_details_for_udi (app=0x1cca4d0,
udi=0x1cdb1d0 "p��\001", mac=0x7fff49875070)
    at main.c:244
#7  0x00000000004081bd in add_default_dhcp_connection
(user_data=0x1cda560) at main.c:351
#8  0x00007fe93e86750b in g_timeout_dispatch (source=0x1cd6a00,
callback=0x3e71, user_data=0x6)
    at /build/buildd/glib2.0-2.18.1/glib/gmain.c:3587
#9  0x00007fe93e866d4b in IA__g_main_context_dispatch
(context=0x1cd4b50)
    at /build/buildd/glib2.0-2.18.1/glib/gmain.c:2142
#10 0x00007fe93e86a51d in g_main_context_iterate (context=0x1cd4b50,
block=1, dispatch=1, 
    self=<value optimized out>) at
    /build/buildd/glib2.0-2.18.1/glib/gmain.c:2776
#11 0x00007fe93e86aa4d in IA__g_main_loop_run (loop=0x1ccb460) at
/build/buildd/glib2.0-2.18.1/glib/gmain.c:2984
#12 0x0000000000408ce6 in main (argc=1, argv=0x7fff49875438) at
main.c:663



 - Alexander

=== modified file 'ChangeLog'
--- ChangeLog	2008-10-02 17:11:42 +0000
+++ ChangeLog	2008-10-03 02:52:39 +0000
@@ -1,8 +1,18 @@
+2008-10-03  Alexander Sack  <asac ubuntu com>
+
+	Fix crash of nm-system-settings in add_default_dhcp_connection when wired
+	device gets removed.
+
+	* system-settings/src/main.c:
+		- (add_default_dhcp_connection,device_removed_cb):
+			passing the "key" instead of the value as second argument
+			to g_hash_table_remove calls helps.
+
 2008-10-02  Dan Williams  <dcbw redhat com>
 
 	* src/nm-gsm-device.c
 		- (enter_pin_done, enter_pin, check_pin_done, real_act_stage1_prepare):
 			pass the required GSM secret along via user_data rather than keeping
 			it around in the private data where it sometimes didn't get cleared
 		- (real_get_ppp_name): implement using the GSM username
 

=== modified file 'system-settings/src/main.c'
--- system-settings/src/main.c	2008-08-27 02:57:21 +0000
+++ system-settings/src/main.c	2008-10-03 02:52:39 +0000
@@ -377,17 +377,17 @@ add_default_dhcp_connection (gpointer us
 	g_byte_array_append (s_wired->mac_address, info->mac->data, ETH_ALEN);
 	nm_connection_add_setting (wrapped, NM_SETTING (s_wired));
 
 	nm_sysconfig_settings_add_connection (info->app->settings, info->connection);
 
 	return FALSE;
 
 ignore:
-	g_hash_table_remove (info->app->wired_devices, info);
+	g_hash_table_remove (info->app->wired_devices, info->udi);
 	return FALSE;
 }
 
 static void
 device_added_cb (DBusGProxy *proxy, const char *udi, NMDeviceType devtype, gpointer user_data)
 {
 	Application *app = (Application *) user_data;
 	WiredDeviceInfo *info;
@@ -408,17 +408,17 @@ device_removed_cb (DBusGProxy *proxy, co
 {
 	Application *app = (Application *) user_data;
 	WiredDeviceInfo *info;
 
 	info = g_hash_table_lookup (app->wired_devices, udi);
 	if (!info)
 		return;
 
-	g_hash_table_remove (app->wired_devices, info);
+	g_hash_table_remove (app->wired_devices, info->udi);
 }
 
 /******************************************************************/
 
 static void
 dbus_cleanup (Application *app)
 {
 	if (app->g_connection) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]