[Interest] Double destruction of Qt objects in Qt example code?
sh at theharmers.co.uk
Sun Aug 19 19:50:29 CEST 2012
On 19/08/2012 17:19, Richard Moore wrote:
> On 19 August 2012 16:18, Till Oliver Knoll <till.oliver.knoll at gmail.com> wrote:
>> However it never occured to me to actually try such a thing. I mean,
>> what would be a practical scenario where one wanted to explicitly call a
>> d'tor? So clean up resources before the actual object gets destroyed
>> (assuming that the code inside the d'tor would take care not to delete
>> resources twice, such that it would be okay to call a d'tor several times)?
> It's used when you're writing custom allocators such as a SLAB
> allocator. In that situation you want to separate the running of the
> destructor from the memory allocation.
It can also be used with placement new operator.
> Interest mailing list
> Interest at qt-project.org
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Interest