]> saetta.ns0.it Git - zakauthe/libzakauthe/commitdiff
Added aute_finalize.
authorAndrea Zagli <azagli@libero.it>
Sat, 13 Feb 2010 09:11:55 +0000 (10:11 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 13 Feb 2010 09:11:55 +0000 (10:11 +0100)
src/aute.c

index 7409925c3e2b0c49a43d2bc295f812351a5eb8ea..6b7322ecfe84c303e575b2ac759ee8219d821be0 100644 (file)
@@ -35,6 +35,7 @@ static void aute_get_property (GObject *object,
                                guint property_id,
                                GValue *value,
                                GParamSpec *pspec);
+static void aute_finalize (GObject *object);
 
 GModule *aute_get_module_from_confi (Aute *aute);
 
@@ -61,6 +62,7 @@ aute_class_init (AuteClass *class)
 
        object_class->set_property = aute_set_property;
        object_class->get_property = aute_get_property;
+       object_class->finalize = aute_finalize;
 
        g_type_class_add_private (object_class, sizeof (AutePrivate));
 }
@@ -175,12 +177,6 @@ gchar
        /* calling plugin's function */
        ret = (*autentica) (priv->parameters);
 
-       /* closing the library */
-       if (!g_module_close (priv->module))
-               {
-                       g_fprintf (stderr, "Error g_module_close\n");
-               }
-
        return ret;
 }
 
@@ -221,6 +217,30 @@ aute_get_property (GObject *object,
          }
 }
 
+static void
+aute_finalize (GObject *object)
+{
+       Aute *aute = AUTE (object);
+
+       AutePrivate *priv = AUTE_GET_PRIVATE (aute);
+
+       /* closing the library */
+       if (priv->module != NULL)
+               {
+                       if (!g_module_close (priv->module))
+                               {
+                                       g_fprintf (stderr, "Error g_module_close\n");
+                               }
+                       else
+                               {
+                                       priv->module = NULL;
+                               }
+               }
+
+       /* Chain up to the parent class */
+       G_OBJECT_CLASS (aute_parent_class)->finalize (object);
+}
+
 #ifdef HAVE_LIBCONFI
 /**
  * aute_get_plugin_module: