[perl-Glib-Object-Introspection] Allow setting boxed fields to undef



commit e327f8bc58194ff71f994fe6cda1261962366b85
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Sat May 12 21:53:29 2012 +0200

    Allow setting boxed fields to undef

 NEWS                             |    5 +++++
 lib/Glib/Object/Introspection.pm |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 96cb536..f302639 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Overview of changes in Glib::Object::Introspection <next>
+========================================================
+
+* Allow setting boxed fields to undef.
+
 Overview of changes in Glib::Object::Introspection 0.008
 ========================================================
 
diff --git a/lib/Glib/Object/Introspection.pm b/lib/Glib/Object/Introspection.pm
index 28ebcab..a86f906 100644
--- a/lib/Glib/Object/Introspection.pm
+++ b/lib/Glib/Object/Introspection.pm
@@ -130,7 +130,8 @@ sub setup {
         my ($invocant, $new_value) = @_;
         my $old_value = __PACKAGE__->_get_field($basename, $namespace, $name,
                                                 $invocant);
-        if (defined $new_value) {
+        # If a new value is provided, even if it is undef, update the field.
+        if (scalar @_ > 1) {
           __PACKAGE__->_set_field($basename, $namespace, $name,
                                   $invocant, $new_value);
         }



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