ruby: fix crash on Compound#_cpp_delete

develop
jj 2013-04-14 01:17:44 +02:00
parent 40f9f06360
commit 13451bd487
1 changed files with 2 additions and 1 deletions

@ -122,7 +122,8 @@ module DFHack
_fields_ancestors.each { |n, o, s| s._at(@_memaddr+o)._cpp_init } _fields_ancestors.each { |n, o, s| s._at(@_memaddr+o)._cpp_init }
end end
def _cpp_delete def _cpp_delete
_fields_ancestors.each { |n, o, s| s._at(@_memaddr+o)._cpp_delete } # cannot call delete on compound members (would call free on member address)
#_fields_ancestors.each { |n, o, s| s._at(@_memaddr+o)._cpp_delete }
DFHack.free(@_memaddr) DFHack.free(@_memaddr)
@_memaddr = nil # turn future segfaults in harmless ruby exceptions @_memaddr = nil # turn future segfaults in harmless ruby exceptions
end end