summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qjnihelpers.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-01 00:22:35 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-02-16 05:02:34 +0000
commit5486882b5253c858cc545cc3a08f0f89af59578e (patch)
tree664168f27e3597a8a5127316529ded142c1b95bc /src/corelib/kernel/qjnihelpers.cpp
parentee0edf1b0aa36cfdd5d9628b2bbeb1fb590a3290 (diff)
Android: De-duplicate vtables of exported private classes
By making the destructor (usually the first non-inline, non-pure, virtual function, and therefore the trigger for most compilers to emit the vtable and type_info structures for the class in that TU) out-of-line, vtables and, more importantly, type_info structures for the class are pinned to a single TU. This prevents false-negative dynamic_cast and catch evaluation. Since the classes are already exported, users of these classes are unaffected by the change, and since it's private API, we don't need to avoid adding code to the out-of-line destructor until Qt 6. While at it, de-inline also the empty default implementations of virtual (non-dtor) functions. Task-number: QTBUG-45582 Change-Id: I3e6f37eab1dee0db445f6c13638a43ca3bf6ac62 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qjnihelpers.cpp')
-rw-r--r--src/corelib/kernel/qjnihelpers.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index 6a46f7dd11..091280400e 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -52,6 +52,18 @@
QT_BEGIN_NAMESPACE
+namespace QtAndroidPrivate {
+ // *Listener virtual function implementations.
+ // Defined out-of-line to pin the vtable/type_info.
+ ActivityResultListener::~ActivityResultListener() {}
+ NewIntentListener::~NewIntentListener() {}
+ ResumePauseListener::~ResumePauseListener() {}
+ void ResumePauseListener::handlePause() {}
+ void ResumePauseListener::handleResume() {}
+ GenericMotionEventListener::~GenericMotionEventListener() {}
+ KeyEventListener::~KeyEventListener() {}
+}
+
static JavaVM *g_javaVM = Q_NULLPTR;
static jobject g_jActivity = Q_NULLPTR;
static jobject g_jService = Q_NULLPTR;