[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
CAPE-OPEN • View topic - Call to release and primary object destructor
Page 1 of 1

Call to release and primary object destructor

PostPosted: 02 July 2021, 12:05
by ahmedsabriz

Re: Call to release and primary object destructor

PostPosted: 03 July 2021, 10:28
by jasper
In a typical implementation, such objects are assigned to smart pointers, which will take care of the deletion.

So in your example the parameter collection contains a smart pointer to the parameter. So when the parameter collection ends to exists, the destructor of the smart pointer invokes delete on the parameter. The unit operaton in turn has a smart pointer that contains the reference to the parameter collection. So when the unit operation gets released by the PME it deletes itself, and with that the smart pointer gets destructed and deletes the parameter collection.

Same for the ports and the port collection: the ports are referenced by smart pointers in the port collection (and perhaps also by smart pointers in the unit operation), and the port collection is referenced by the smart pointer in the unit operation.

If you set a break point on the destructor of the parameter, parameter collection, port or port collection, you see the call stack when this happens.