network-manager-applet r478 - in trunk: . src/wireless-security



Author: dcbw
Date: Fri Jan 25 17:01:52 2008
New Revision: 478
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=478&view=rev

Log:
2008-01-25  Dan Williams  <dcbw redhat com>

	* src/wireless-security/eap-method-leap.c
	  src/wireless-security/eap-method-peap.c
	  src/wireless-security/eap-method-simple.c
	  src/wireless-security/eap-method-tls.c
	  src/wireless-security/eap-method-ttls.c
	  src/wireless-security/eap-method.c
	  src/wireless-security/wireless-security.c
	  src/wireless-security/ws-dynamic-wep.c
	  src/wireless-security/ws-leap.c
	  src/wireless-security/ws-wep-key.c
	  src/wireless-security/ws-wep-passphrase.c
	  src/wireless-security/ws-wpa-eap.c
	  src/wireless-security/ws-wpa-psk.c
		- Fix leaks; be sure to sink the notebook widgets obtained from Glade,
			then don't ref them again when passing them to the generic class
			init functions.  Make the generic class's unref handler clean up
			the generic class's data instead of the children having to do it.



Modified:
   trunk/ChangeLog
   trunk/src/wireless-security/eap-method-leap.c
   trunk/src/wireless-security/eap-method-peap.c
   trunk/src/wireless-security/eap-method-simple.c
   trunk/src/wireless-security/eap-method-tls.c
   trunk/src/wireless-security/eap-method-ttls.c
   trunk/src/wireless-security/eap-method.c
   trunk/src/wireless-security/wireless-security.c
   trunk/src/wireless-security/ws-dynamic-wep.c
   trunk/src/wireless-security/ws-leap.c
   trunk/src/wireless-security/ws-wep-key.c
   trunk/src/wireless-security/ws-wep-passphrase.c
   trunk/src/wireless-security/ws-wpa-eap.c
   trunk/src/wireless-security/ws-wpa-psk.c

Modified: trunk/src/wireless-security/eap-method-leap.c
==============================================================================
--- trunk/src/wireless-security/eap-method-leap.c	(original)
+++ trunk/src/wireless-security/eap-method-leap.c	Fri Jan 25 17:01:52 2008
@@ -45,7 +45,6 @@
 {
 	EAPMethodLEAP *method = (EAPMethodLEAP *) parent;
 
-	g_object_unref (parent->xml);
 	g_slice_free (EAPMethodLEAP, method);
 }
 
@@ -129,10 +128,12 @@
 
 	widget = glade_xml_get_widget (xml, "eap_leap_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	method = g_slice_new0 (EAPMethodLEAP);
 	if (!method) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -142,7 +143,7 @@
 	                 fill_connection,
 	                 destroy,
 	                 xml,
-	                 g_object_ref (widget));
+	                 widget);
 
 	widget = glade_xml_get_widget (xml, "eap_leap_username_entry");
 	g_assert (widget);

Modified: trunk/src/wireless-security/eap-method-peap.c
==============================================================================
--- trunk/src/wireless-security/eap-method-peap.c	(original)
+++ trunk/src/wireless-security/eap-method-peap.c	Fri Jan 25 17:01:52 2008
@@ -37,7 +37,6 @@
 {
 	EAPMethodPEAP *method = (EAPMethodPEAP *) parent;
 
-	g_object_unref (parent->xml);
 	g_object_unref (method->nag_dialog_xml);
 	if (method->size_group)
 		g_object_unref (method->size_group);
@@ -365,11 +364,13 @@
 
 	widget = glade_xml_get_widget (xml, "eap_peap_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	method = g_slice_new0 (EAPMethodPEAP);
 	if (!method) {
 		g_object_unref (nag_dialog_xml);
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -379,7 +380,7 @@
 	                 fill_connection,
 	                 destroy,
 	                 xml,
-	                 g_object_ref (widget));
+	                 widget);
 
 	EAP_METHOD (method)->nag_user = nag_user;
 	method->nag_dialog_xml = nag_dialog_xml;

Modified: trunk/src/wireless-security/eap-method-simple.c
==============================================================================
--- trunk/src/wireless-security/eap-method-simple.c	(original)
+++ trunk/src/wireless-security/eap-method-simple.c	Fri Jan 25 17:01:52 2008
@@ -45,7 +45,6 @@
 {
 	EAPMethodSimple *method = (EAPMethodSimple *) parent;
 
-	g_object_unref (parent->xml);
 	g_slice_free (EAPMethodSimple, method);
 }
 
@@ -145,10 +144,12 @@
 
 	widget = glade_xml_get_widget (xml, "eap_simple_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	method = g_slice_new0 (EAPMethodSimple);
 	if (!method) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -158,7 +159,7 @@
 	                 fill_connection,
 	                 destroy,
 	                 xml,
-	                 g_object_ref (widget));
+	                 widget);
 
 	method->type = type;
 

Modified: trunk/src/wireless-security/eap-method-tls.c
==============================================================================
--- trunk/src/wireless-security/eap-method-tls.c	(original)
+++ trunk/src/wireless-security/eap-method-tls.c	Fri Jan 25 17:01:52 2008
@@ -49,7 +49,6 @@
 	EAPMethodTLS *method = (EAPMethodTLS *) parent;
 
 	g_object_unref (method->nag_dialog_xml);
-	g_object_unref (parent->xml);
 	g_slice_free (EAPMethodTLS, method);
 }
 
@@ -356,11 +355,13 @@
 
 	widget = glade_xml_get_widget (xml, "eap_tls_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	method = g_slice_new0 (EAPMethodTLS);
 	if (!method) {
 		g_object_unref (xml);
 		g_object_unref (nag_dialog_xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -370,7 +371,7 @@
 	                 fill_connection,
 	                 destroy,
 	                 xml,
-	                 g_object_ref (widget));
+	                 widget);
 
 	EAP_METHOD (method)->nag_user = nag_user;
 	method->nag_dialog_xml = nag_dialog_xml;

Modified: trunk/src/wireless-security/eap-method-ttls.c
==============================================================================
--- trunk/src/wireless-security/eap-method-ttls.c	(original)
+++ trunk/src/wireless-security/eap-method-ttls.c	Fri Jan 25 17:01:52 2008
@@ -37,7 +37,6 @@
 {
 	EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
 
-	g_object_unref (parent->xml);
 	g_object_unref (method->nag_dialog_xml);
 	if (method->size_group)
 		g_object_unref (method->size_group);
@@ -376,11 +375,13 @@
 
 	widget = glade_xml_get_widget (xml, "eap_ttls_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	method = g_slice_new0 (EAPMethodTTLS);
 	if (!method) {
 		g_object_unref (nag_dialog_xml);
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -390,7 +391,7 @@
 	                 fill_connection,
 	                 destroy,
 	                 xml,
-	                 g_object_ref (widget));
+	                 widget);
 
 	EAP_METHOD (method)->nag_user = nag_user;
 	method->nag_dialog_xml = nag_dialog_xml;

Modified: trunk/src/wireless-security/eap-method.c
==============================================================================
--- trunk/src/wireless-security/eap-method.c	(original)
+++ trunk/src/wireless-security/eap-method.c	Fri Jan 25 17:01:52 2008
@@ -133,8 +133,11 @@
 	g_assert (method->destroy);
 
 	method->refcount--;
-	if (method->refcount == 0)
+	if (method->refcount == 0) {
+		g_object_unref (method->xml);
+		g_object_unref (method->ui_widget);
 		(*(method->destroy)) (method);
+	}
 }
 
 gboolean

Modified: trunk/src/wireless-security/wireless-security.c
==============================================================================
--- trunk/src/wireless-security/wireless-security.c	(original)
+++ trunk/src/wireless-security/wireless-security.c	Fri Jan 25 17:01:52 2008
@@ -121,8 +121,11 @@
 	g_assert (sec->destroy);
 
 	sec->refcount--;
-	if (sec->refcount == 0)
+	if (sec->refcount == 0) {
+		g_object_unref (sec->xml);
+		g_object_unref (sec->ui_widget);
 		(*(sec->destroy)) (sec);
+	}
 }
 
 void

Modified: trunk/src/wireless-security/ws-dynamic-wep.c
==============================================================================
--- trunk/src/wireless-security/ws-dynamic-wep.c	(original)
+++ trunk/src/wireless-security/ws-dynamic-wep.c	Fri Jan 25 17:01:52 2008
@@ -33,7 +33,6 @@
 {
 	WirelessSecurityDynamicWEP *sec = (WirelessSecurityDynamicWEP *) parent;
 
-	g_object_unref (parent->xml);
 	if (sec->size_group)
 		g_object_unref (sec->size_group);
 	g_slice_free (WirelessSecurityDynamicWEP, sec);
@@ -114,10 +113,12 @@
 
 	widget = glade_xml_get_widget (xml, "dynamic_wep_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	sec = g_slice_new0 (WirelessSecurityDynamicWEP);
 	if (!sec) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -127,7 +128,7 @@
 	                        fill_connection,
 	                        destroy,
 	                        xml,
-	                        g_object_ref (widget));
+	                        widget);
 
 	WIRELESS_SECURITY (sec)->nag_user = nag_user;
 

Modified: trunk/src/wireless-security/ws-leap.c
==============================================================================
--- trunk/src/wireless-security/ws-leap.c	(original)
+++ trunk/src/wireless-security/ws-leap.c	Fri Jan 25 17:01:52 2008
@@ -45,7 +45,6 @@
 {
 	WirelessSecurityLEAP *sec = (WirelessSecurityLEAP *) parent;
 
-	g_object_unref (parent->xml);
 	g_slice_free (WirelessSecurityLEAP, sec);
 }
 
@@ -128,10 +127,12 @@
 
 	widget = glade_xml_get_widget (xml, "leap_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	sec = g_slice_new0 (WirelessSecurityLEAP);
 	if (!sec) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -141,7 +142,7 @@
 	                        fill_connection,
 	                        destroy,
 	                        xml,
-	                        g_object_ref (widget));
+	                        widget);
 
 	widget = glade_xml_get_widget (xml, "leap_password_entry");
 	g_assert (widget);

Modified: trunk/src/wireless-security/ws-wep-key.c
==============================================================================
--- trunk/src/wireless-security/ws-wep-key.c	(original)
+++ trunk/src/wireless-security/ws-wep-key.c	Fri Jan 25 17:01:52 2008
@@ -45,7 +45,6 @@
 {
 	WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) parent;
 
-	g_object_unref (parent->xml);
 	g_slice_free (WirelessSecurityWEPKey, sec);
 }
 
@@ -178,10 +177,12 @@
 
 	widget = glade_xml_get_widget (xml, "wep_key_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	sec = g_slice_new0 (WirelessSecurityWEPKey);
 	if (!sec) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -191,7 +192,7 @@
 	                        fill_connection,
 	                        destroy,
 	                        xml,
-	                        g_object_ref (widget));
+	                        widget);
 	sec->type = type;
 
 	widget = glade_xml_get_widget (xml, "wep_key_entry");

Modified: trunk/src/wireless-security/ws-wep-passphrase.c
==============================================================================
--- trunk/src/wireless-security/ws-wep-passphrase.c	(original)
+++ trunk/src/wireless-security/ws-wep-passphrase.c	Fri Jan 25 17:01:52 2008
@@ -46,7 +46,6 @@
 {
 	WirelessSecurityWEPPassphrase *sec = (WirelessSecurityWEPPassphrase *) parent;
 
-	g_object_unref (parent->xml);
 	g_slice_free (WirelessSecurityWEPPassphrase, sec);
 }
 
@@ -139,10 +138,12 @@
 
 	widget = glade_xml_get_widget (xml, "wep_passphrase_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	sec = g_slice_new0 (WirelessSecurityWEPPassphrase);
 	if (!sec) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -152,7 +153,7 @@
 	                        fill_connection,
 	                        destroy,
 	                        xml,
-	                        g_object_ref (widget));
+	                        widget);
 
 	widget = glade_xml_get_widget (xml, "wep_passphrase_entry");
 	g_assert (widget);

Modified: trunk/src/wireless-security/ws-wpa-eap.c
==============================================================================
--- trunk/src/wireless-security/ws-wpa-eap.c	(original)
+++ trunk/src/wireless-security/ws-wpa-eap.c	Fri Jan 25 17:01:52 2008
@@ -33,7 +33,6 @@
 {
 	WirelessSecurityWPAEAP *sec = (WirelessSecurityWPAEAP *) parent;
 
-	g_object_unref (parent->xml);
 	if (sec->size_group)
 		g_object_unref (sec->size_group);
 	g_slice_free (WirelessSecurityWPAEAP, sec);
@@ -111,10 +110,12 @@
 
 	widget = glade_xml_get_widget (xml, "wpa_eap_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	sec = g_slice_new0 (WirelessSecurityWPAEAP);
 	if (!sec) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -124,7 +125,7 @@
 	                        fill_connection,
 	                        destroy,
 	                        xml,
-	                        g_object_ref (widget));
+	                        widget);
 
 	WIRELESS_SECURITY (sec)->nag_user = nag_user;
 

Modified: trunk/src/wireless-security/ws-wpa-psk.c
==============================================================================
--- trunk/src/wireless-security/ws-wpa-psk.c	(original)
+++ trunk/src/wireless-security/ws-wpa-psk.c	Fri Jan 25 17:01:52 2008
@@ -48,7 +48,6 @@
 {
 	WirelessSecurityWPAPSK *sec = (WirelessSecurityWPAPSK *) parent;
 
-	g_object_unref (parent->xml);
 	g_slice_free (WirelessSecurityWPAPSK, sec);
 }
 
@@ -164,10 +163,12 @@
 
 	widget = glade_xml_get_widget (xml, "wpa_psk_notebook");
 	g_assert (widget);
+	g_object_ref_sink (widget);
 
 	sec = g_slice_new0 (WirelessSecurityWPAPSK);
 	if (!sec) {
 		g_object_unref (xml);
+		g_object_unref (widget);
 		return NULL;
 	}
 
@@ -177,7 +178,7 @@
 	                        fill_connection,
 	                        destroy,
 	                        xml,
-	                        g_object_ref (widget));
+	                        widget);
 
 	widget = glade_xml_get_widget (xml, "wpa_psk_entry");
 	g_assert (widget);



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