-----BEGIN PGP SIGNED MESSAGE-----
Moin,
On Thursday 11 March 2004 12:30, Vladimir Marek wrote:
I do have C++ object typemapped into perl class. Then I have two functions which creates and destroys that object
If anyone cares, I found different, imho better and easier solution. Just whenever new object is created, I store to map it's pointer. When object is destroyed, I delete his pointer from the map. Then I overloaded the DESTROY method, so that it first check if the pointer is in the map, and call actual delete(obj) only if it is found.
Why simple solution is found as the last one usually ? :)
Hm, that still sounds way to complicated to me. AFAIK DESTROY() is called only _once_ per object.So why doyou think you need to check the map for
the pointer? Why can't you just call delete(obj) from DESTROY() regardless?
The object is message sent over network. Actual sending does C++ library which has own thread for sending the message, and which frees the object when it is sent. When I pass the object to the sending function, perl does not know that message (created in perl by 'new') is allready destroyed in C++ library. On the other hand, When I create message in perl, it does not automatically mean it will be sent over the network, so sometimes is calling 'delete' needed.
Vladimir Marek