swig-devel

Bugs item #1585696, was opened at 2006-10-27 10:20
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1585696&group_id=1645
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: perl
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Petr Novotny (petr_novotny)
Assigned to: Nobody/Anonymous (nobody)
Summary: %unrefobject and class with private destructor
Initial Comment:
With an %unrefobject, I can specify what Swig does
with an object when it deletes it. Unfortunately, if
an object has a private destructor, the "delete_TYPE"
wrapper is not generated and %unrefobject has nothing
to act upon.
I suggest to change the behaviour, so that the
existence of %unrefobject triggers generation
of "delete_TYPE".
A real-life example when it is needed: A C++ class
uses a factory method to create, and "recycle" method
(is there a standard name for this pattern?) to
dispose of the pointer. To prevent clients from
delete'ing the pointer, the destructor is hidden. I
expected that I label the factory method with %
newobject and I supply the recycle method with %
unrefobject - but unless I make the destructor public
(at least as far as swig is concerned), swig doesn't
tell Perl to run any action on DESTROY.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1585696&group_id=1645