[amtk] Use g_{set,clear}_weak_pointer()



commit 287e1f7d718e86a2f4cf3fa1e3e6f2384198d88d
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun May 10 20:16:12 2020 +0200

    Use g_{set,clear}_weak_pointer()

 README              |  2 +-
 amtk/amtk-factory.c | 14 ++------------
 configure.ac        |  2 +-
 3 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/README b/README
index df70acc..b0f99b7 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@ The Amtk web page:
 Dependencies
 ------------
 
-- GLib >= 2.52
+- GLib >= 2.56
 - GTK >= 3.22
 
 Installation
diff --git a/amtk/amtk-factory.c b/amtk/amtk-factory.c
index 267e252..1d4906f 100644
--- a/amtk/amtk-factory.c
+++ b/amtk/amtk-factory.c
@@ -240,12 +240,7 @@ amtk_factory_set_property (GObject      *object,
        {
                case PROP_APPLICATION:
                        g_assert (factory->priv->app == NULL);
-                       factory->priv->app = g_value_get_object (value);
-                       if (factory->priv->app != NULL)
-                       {
-                               g_object_add_weak_pointer (G_OBJECT (factory->priv->app),
-                                                          (gpointer *) &factory->priv->app);
-                       }
+                       g_set_weak_pointer (&factory->priv->app, g_value_get_object (value));
                        break;
 
                case PROP_DEFAULT_FLAGS:
@@ -263,12 +258,7 @@ amtk_factory_dispose (GObject *object)
 {
        AmtkFactory *factory = AMTK_FACTORY (object);
 
-       if (factory->priv->app != NULL)
-       {
-               g_object_remove_weak_pointer (G_OBJECT (factory->priv->app),
-                                             (gpointer *) &factory->priv->app);
-               factory->priv->app = NULL;
-       }
+       g_clear_weak_pointer (&factory->priv->app);
 
        G_OBJECT_CLASS (amtk_factory_parent_class)->dispose (object);
 }
diff --git a/configure.ac b/configure.ac
index bd83347..885f034 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ AMTK_API_VERSION=5
 AC_SUBST([AMTK_API_VERSION])
 
 # Dependencies
-glib_req=2.52
+glib_req=2.56
 gtk_req=3.22
 
 AC_CONFIG_SRCDIR([amtk/amtk.h])


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