[Development] Allowing event delivery prior to and after QCoreApplication
Thiago Macieira
thiago.macieira at intel.com
Tue Apr 14 17:27:57 CEST 2015
On Tuesday 14 April 2015 16:56:19 René J.V. Bertin wrote:
[cut]
> ObjC is so intricately linked to OS X, because from a few quick attempts it
> seems to be perfectly possible to use an ObjC++ wrapper class to extend the
> retain/release scheme to C++ classes.
>
> Is this clear enough?
Yes, thank you.
C++ already has that, it's called reference counting. You may have heard we
use it in Qt :-)
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:
int main(int argc, char **argv)
{
SomeApplication app(argc, argv);
[rest of the application]
}
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.
We can only catch it half-way through, when the destruction has reached one of
our classes (~QApplication, ~QGuiApplication or ~QCoreApplication), by which
time the virtual table has already changed and it's too late.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list