On Tuesday April 14 2015 08:27:57 Thiago Macieira wrote:

>C++ already has that, it's called reference counting. You may have heard we 
>use it in Qt :-)

Well, reference counting can be used for many things (like deleteLater, I 
presume) :)

>The problem here is that QCoreApplication is not reference counted and we 
>can't change it without breaking *every* *single* *application*, since this is 
>what people usually do:

>That stack declaration is the problem here. The app object will be destroyed 
>at the closing brace, whether we want it or not, and there's nothing we can do 
>to prevent it, delay it or even hook something as it begins.

Yes, the issue is that C++ does an immediate delete that you cannot really 
cancel.

This may be an open door, but couldn't you change the application's entry point 
(or provide an alternative entry point like KDE does with kdemain). That gives 
you an extra layer around what the user sees as the main function. Combine that 
with a modified private class with a d pointer that does not necessarily get 
deleted when the Q*Application dtor is called, and you may have a solution?
You won't be breaking any applications, and users can decide for themselves 
if/when they change their code to make use of the new approach.

R.
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to