[Interest] Qt ownership model

Антон Жилин antonyzhilin at gmail.com
Sat Jun 4 19:13:40 CEST 2016


The aim of these suggestions is not to change how memory management works
in Qt, but to wrap it in a uniform syntax, and by the way, eliminate the
need for explicit usage of `new`.
We need to view each case of memory allocation that is used somewhere in Qt
and think about how to express it in this syntax.

- Anton

2016-06-04 19:09 GMT+03:00 Nye <kshegunov at gmail.com>:

> 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/a6ea16df/attachment.html>


More information about the Interest mailing list