diff options
author | Volker Krause <volker.krause@kdab.com> | 2014-04-15 13:11:40 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-15 17:50:20 +0200 |
commit | d953d9a4c3bdc5ed3b8d380c4b893b51b523bc50 (patch) | |
tree | b67db3a09a37be745f060de11a4c110eb7e9aee1 /src/corelib/kernel/qcoreapplication.cpp | |
parent | 78a1c46a86e205e599d641ffb3eae721705e0d1e (diff) |
Add a more reliable replacement for qt_add/removeObject().
These hooks only worked reliably with LD_PRELOAD on Linux/GCC, on other
platforms they depended on what exactly the compiler optimizer is doing
as well as some nasty assembler rewriting to actually access them. The
new system uses a simple array of function pointers that can be set to
custom hooks by tools that need this (based on ideas from Andre Poenitz).
This also covers qt_startup_hook (similar problem), and the Qt version
number that Andre had asked for.
Change-Id: I2c3e7950fd49b1b1d04176be34c2fff3293981b0
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6868eb6a1e..7d42ffd29d 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -71,6 +71,7 @@ #include <private/qfactoryloader_p.h> #include <private/qfunctions_p.h> #include <private/qlocale_p.h> +#include <private/qhooks_p.h> #ifndef QT_NO_QOBJECT #if defined(Q_OS_UNIX) @@ -765,6 +766,10 @@ void QCoreApplication::init() qt_call_pre_routines(); qt_startup_hook(); +#ifndef QT_BOOTSTRAPPED + if (Q_UNLIKELY(qtHookData[QHooks::Startup])) + reinterpret_cast<QHooks::StartupCallback>(qtHookData[QHooks::Startup])(); +#endif #ifndef QT_NO_QOBJECT QCoreApplicationPrivate::is_app_running = true; // No longer starting up. |