Skip to content

Commit 764a777

Browse files
committed
Don't run marker or finalizers for null pointers.
1 parent ff0fe7b commit 764a777

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/truffle/truffle/cext.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ def data_finalizer(free, data_holder)
14511451
# In a separate method to avoid capturing the object
14521452
raise unless free.respond_to?(:call)
14531453
proc {
1454-
execute_with_mutex(free, data_holder.data)
1454+
execute_with_mutex(free, data_holder.data) unless data_holder.data.nil?
14551455
}
14561456
end
14571457

@@ -1460,7 +1460,7 @@ def data_marker(mark, data_holder)
14601460
raise unless mark.respond_to?(:call)
14611461
proc { |obj|
14621462
create_mark_list
1463-
execute_with_mutex(mark, data_holder.data)
1463+
execute_with_mutex(mark, data_holder.data) unless data_holder.data.nil?
14641464
set_mark_list_on_object(obj)
14651465
}
14661466
end

0 commit comments

Comments
 (0)