[network-manager-applet] editor: initialize the destroy handler at last in eap_method_init/wireless_security_init



commit d181a83d9a9988ae62a07aa09452b4278afb816f
Author: Thomas Haller <thaller redhat com>
Date:   Thu Sep 12 11:41:41 2013 +0200

    editor: initialize the destroy handler at last in eap_method_init/wireless_security_init
    
    When 'eap_method_init' or 'wireless_security_init' fails to read the
    UI xml file, it calls 'eap_method_unref' or 'wireless_security_unref',
    respectively. The unref methods call the destroy handler, but they
    should not do it in this case, because the objects were not fully
    constructed.
    
    Fix this, be setting the destroy handler only at the end of
    the init methods.
    
    Signed-off-by: Thomas Haller <thaller redhat com>

 src/wireless-security/eap-method.c        |    3 ++-
 src/wireless-security/wireless-security.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c
index 23bedd7..28e2e05 100644
--- a/src/wireless-security/eap-method.c
+++ b/src/wireless-security/eap-method.c
@@ -158,7 +158,6 @@ eap_method_init (gsize obj_size,
        method->add_to_size_group = add_to_size_group;
        method->fill_connection = fill_connection;
        method->update_secrets = update_secrets;
-       method->destroy = destroy;
        method->default_field = default_field;
        method->phase2 = phase2;
 
@@ -179,6 +178,8 @@ eap_method_init (gsize obj_size,
        }
        g_object_ref_sink (method->ui_widget);
 
+       method->destroy = destroy;
+
        return method;
 }
 
diff --git a/src/wireless-security/wireless-security.c b/src/wireless-security/wireless-security.c
index 73315b1..bd650fd 100644
--- a/src/wireless-security/wireless-security.c
+++ b/src/wireless-security/wireless-security.c
@@ -182,7 +182,6 @@ wireless_security_init (gsize obj_size,
        sec->add_to_size_group = add_to_size_group;
        sec->fill_connection = fill_connection;
        sec->update_secrets = update_secrets;
-       sec->destroy = destroy;
        sec->default_field = default_field;
 
        sec->builder = gtk_builder_new ();
@@ -203,6 +202,7 @@ wireless_security_init (gsize obj_size,
        }
        g_object_ref_sink (sec->ui_widget);
 
+       sec->destroy = destroy;
        sec->adhoc_compatible = TRUE;
 
        return sec;


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