lib/perobs/ObjectBase.rb in perobs-3.0.2 vs lib/perobs/ObjectBase.rb in perobs-4.0.0

- old
+ new

@@ -131,23 +131,24 @@ # param p [PEROBS::Handle] PEROBS handle def _initialize(p) @store = p.store @_id = p.id @store._register_in_memory(self, @_id) - ObjectSpace.define_finalizer(self, ObjectBase._finalize(@store, @_id)) + ObjectSpace.define_finalizer( + self, ObjectBase._finalize(@store, @_id, object_id)) @_stash_map = nil # Allocate a proxy object for this object. User code should only operate # on this proxy, never on self. @myself = POXReference.new(@store, @_id) end # This method generates the destructor for the objects of this class. It # is done this way to prevent the Proc object hanging on to a reference to # self which would prevent the object from being collected. This internal # method is not intended for users to call. - def ObjectBase._finalize(store, id) - proc { store._collect(id) } + def ObjectBase._finalize(store, id, ruby_object_id) + proc { store._collect(id, ruby_object_id) } end # Library internal method to transfer the Object to a new store. # @param store [Store] New store def _transfer(store) @@ -156,10 +157,11 @@ # store. ObjectSpace.undefine_finalizer(self) # Register the object as in-memory object with the new store. @store._register_in_memory(self, @_id) # Register the finalizer for the new store. - ObjectSpace.define_finalizer(self, ObjectBase._finalize(@store, @_id)) + ObjectSpace.define_finalizer( + self, ObjectBase._finalize(@store, @_id, object_id)) @myself = POXReference.new(@store, @_id) end # This method can be overloaded by derived classes to do some massaging on # the data after it has been restored from the database. This could either