On 04/05/16 21:11, André Somers wrote:
Op 04/05/2016 om 16:48 schreef Nikos Chantziaras:
I've been removing every trance of 'new' and 'delete' from my code and
switching to something like:
auto obj = std::make_unique<Type>(ctor args);
(Or std::make_shared, depending on the situation.)
But for QObjects with a parent, that can go horribly wrong. So I have
to do annoying stuff like:
auto dialog = new QDialog(parent);
// work...
delete dialog;
Assuming the above is one function, you could just do:
auto dialog = QDialog(parent);
//work
//end of scope, dialog gets deleted
When 'parent' gets deleted before 'dialog', then 'dialog' gets deleted
even though it's on the stack.
So that doesn't work.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest