diff --git a/lib/ffi-gobject/value.rb b/lib/ffi-gobject/value.rb
index <HASH>..<HASH> 100644
--- a/lib/ffi-gobject/value.rb
+++ b/lib/ffi-gobject/value.rb
@@ -18,11 +18,13 @@ module GObject
     def self.make_finalizer(struct, gtype)
       proc do
         ptr = struct.to_ptr
-        ptr.autorelease = false
-        unless struct[:g_type] == TYPE_INVALID
-          GObject::Lib.g_value_unset ptr
+        if ptr.autorelease?
+          ptr.autorelease = false
+          unless struct[:g_type] == TYPE_INVALID
+            GObject::Lib.g_value_unset ptr
+          end
+          GObject.boxed_free gtype, ptr
         end
-        GObject.boxed_free gtype, ptr
       end
     end
 
@@ -111,6 +113,12 @@ module GObject
       end
     end
 
+    def self.copy_value_to_pointer(value, pointer, offset = 0)
+      super(value, pointer, offset).tap do |result|
+        value.to_ptr.autorelease = false if value
+      end
+    end
+
     private
 
     def set_ruby_value(val)
Do not free GObject::Value that has been copied