I think that this case might be handled by using a smart pointer with a custom 
empty deleter. In this case we have absolutely the same potential issues as 
with a raw pointer to a stack object. Strictly speaking, something like that 
requires a great care and I'd recommend avoiding such approach.

On 2/4/20 1:22 PM, Konstantin Shegunov wrote:
On Tue, Feb 4, 2020 at 12:15 PM Vitaly Fanaskov 
<vitaly.fanas...@qt.io<mailto:vitaly.fanas...@qt.io>> wrote:
I think, if we decide to re-implement parent-child model using smart
pointers, we would not use unique pointers at all. Even in a methods
like QObject::makeChild (because ownership is already defined). Shared +
weak pointers make perfect sense here.

You have to be really crafty. Allocating on the stack is a thing, you know, 
even for parent-child trees, so how do you intend to handle that? Are we again 
in "forget the stack and new everything" land?

--
Best Regards,

Fanaskov Vitaly
Senior Software Engineer

The Qt Company / Qt Quick and Widgets Team
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to