[Interest] Double destruction of Qt objects in Qt example code?

Richard Moore rich at kde.org
Sun Aug 19 18:19:24 CEST 2012


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.

Cheers

Rich.



More information about the Interest mailing list