On 16/03/16 16:12, Jan Kundrát wrote:
On Wednesday, 16 March 2016 15:07:30 CET, Nikos Chantziaras wrote:
      QApplication app = new QApplication(/* ... */);
      app->exec();
      delete app;

There's no point to use heap allocation in this context. You can simply
create a QApplication instance on stack in your main.

Indeed. But I needed an example with a pointer. If you use a stack object, you'd obviously never have the problem of deleting it to begin with :-)

The point is, you *do* delete qApp *if* it's on the heap, but most people who do have qApp on the heap don't bother with delete, since the process exits anyway. Since in the OP's case the process doesn't exit, qApp should actually be deleted.

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to