[glib: 2/5] Assert that GFileIcon::file is always set after construction




commit e2fbb74301adc2ccaaf9e4e7a8c658322aa6dba2
Author: Sebastian Dröge <sebastian centricular com>
Date:   Tue Nov 10 19:43:41 2020 +0200

    Assert that GFileIcon::file is always set after construction

 gio/gfileicon.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/gio/gfileicon.c b/gio/gfileicon.c
index c77622933..5e6e65250 100644
--- a/gio/gfileicon.c
+++ b/gio/gfileicon.c
@@ -111,6 +111,19 @@ g_file_icon_set_property (GObject      *object,
     }
 }
 
+static void
+g_file_icon_constructed (GObject *object)
+{
+  GFileIcon *icon;
+
+  G_OBJECT_CLASS (g_file_icon_parent_class)->constructed (object);
+
+  icon = G_FILE_ICON (object);
+
+  /* Must have be set during construction */
+  g_assert (icon->file != NULL);
+}
+
 static void
 g_file_icon_finalize (GObject *object)
 {
@@ -132,6 +145,7 @@ g_file_icon_class_init (GFileIconClass *klass)
   gobject_class->get_property = g_file_icon_get_property;
   gobject_class->set_property = g_file_icon_set_property;
   gobject_class->finalize = g_file_icon_finalize;
+  gobject_class->constructed = g_file_icon_constructed;
 
   /**
    * GFileIcon:file:


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