[Interest] Qt ownership model

Nye kshegunov at gmail.com
Sat Jun 4 18:09:06 CEST 2016


On Sat, Jun 4, 2016 at 6:48 PM, Konstantin Tokarev <annulen at yandex.ru>
wrote:
>
> 04.06.2016, 18:10, "charleyb123 ." <charleyb123 at gmail.com>:
> > This is to free the developer from considering implications of (2).
>
> I disagree, (2) is still present as the choice of make-function. It's up
> to you to decide if it will be Foo(...), std::make_shared<Foo>(...),
> std::make_unique<Foo>(...), or something else.


Perhaps, however by using make_shared you're basically saying the object
manages its own lifetime and there's no notion of ownership transfer (i.e.
you can't tell all shared pointers to detach from that object at once).
This basically leads only to working around Qt's ownership system and
ultimately making trouble for yourself (e.g. this thread on the Qt forum
http://forum.qt.io/topic/66639/qcamera-stop-hangs-or-causes-a-crash-how-to-deinit-the-camera-properly
).

Kind regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160604/e896bb5e/attachment.html>


More information about the Interest mailing list