From 729a30a9df1c7a91a4844a5b2474c476276ca427 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 20 Sep 2024 14:15:48 +0200 Subject: [PATCH] De-inline dtors of QAbstractEventDispatcherPrivate subclasses ... pinning the vtables to a single TU each, instead of duplicating them for every user. Task-number: QTBUG-45582 Change-Id: I3b7bce14567dc8be89795a48f6871eb24fe908aa Reviewed-by: Thiago Macieira Reviewed-by: Lena Biliaieva (cherry picked from commit 2e2f5093912faf612f0be72289180b167d6326a7) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qeventdispatcher_glib.cpp | 3 +++ src/corelib/kernel/qeventdispatcher_glib_p.h | 2 ++ src/gui/platform/unix/qeventdispatcher_glib.cpp | 2 ++ src/gui/platform/unix/qeventdispatcher_glib_p.h | 2 ++ src/plugins/platforms/cocoa/qcocoaeventdispatcher.h | 1 + src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 3 +++ 6 files changed, 13 insertions(+) diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 520489939b7..b0fcfd78082 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -322,6 +322,9 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) g_source_attach(&idleTimerSource->source, mainContext); } +QEventDispatcherGlibPrivate::~QEventDispatcherGlibPrivate() + = default; + void QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority() { timerSource->runWithIdlePriority = false; diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h index 30783d38582..2376a7ed8bd 100644 --- a/src/corelib/kernel/qeventdispatcher_glib_p.h +++ b/src/corelib/kernel/qeventdispatcher_glib_p.h @@ -65,6 +65,8 @@ class Q_CORE_EXPORT QEventDispatcherGlibPrivate : public QAbstractEventDispatche public: QEventDispatcherGlibPrivate(GMainContext *context = nullptr); + ~QEventDispatcherGlibPrivate() override; + GMainContext *mainContext; GPostEventSource *postEventSource; GSocketNotifierSource *socketNotifierSource; diff --git a/src/gui/platform/unix/qeventdispatcher_glib.cpp b/src/gui/platform/unix/qeventdispatcher_glib.cpp index 368006f302f..964d844bd53 100644 --- a/src/gui/platform/unix/qeventdispatcher_glib.cpp +++ b/src/gui/platform/unix/qeventdispatcher_glib.cpp @@ -63,6 +63,8 @@ QPAEventDispatcherGlibPrivate::QPAEventDispatcherGlibPrivate(GMainContext *conte g_source_attach(&userEventSource->source, mainContext); } +QPAEventDispatcherGlibPrivate::~QPAEventDispatcherGlibPrivate() + = default; QPAEventDispatcherGlib::QPAEventDispatcherGlib(QObject *parent) : QEventDispatcherGlib(*new QPAEventDispatcherGlibPrivate, parent) diff --git a/src/gui/platform/unix/qeventdispatcher_glib_p.h b/src/gui/platform/unix/qeventdispatcher_glib_p.h index 95fac162376..9c8f06f0e97 100644 --- a/src/gui/platform/unix/qeventdispatcher_glib_p.h +++ b/src/gui/platform/unix/qeventdispatcher_glib_p.h @@ -43,6 +43,8 @@ class QPAEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate Q_DECLARE_PUBLIC(QPAEventDispatcherGlib) public: QPAEventDispatcherGlibPrivate(GMainContext *context = nullptr); + ~QPAEventDispatcherGlibPrivate() override; + GUserEventSource *userEventSource; }; diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h index a2a46bea5d0..0612894501e 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -110,6 +110,7 @@ class QCocoaEventDispatcherPrivate : public QAbstractEventDispatcherPrivate public: QCocoaEventDispatcherPrivate(); + ~QCocoaEventDispatcherPrivate() override; uint processEventsFlags; diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 739fbda4f59..a01801a495b 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -796,6 +796,9 @@ QCocoaEventDispatcherPrivate::QCocoaEventDispatcherPrivate() { } +QCocoaEventDispatcherPrivate::~QCocoaEventDispatcherPrivate() + = default; + void qt_mac_maybeCancelWaitForMoreEventsForwarder(QAbstractEventDispatcher *eventDispatcher) { static_cast(eventDispatcher)->d_func()->maybeCancelWaitForMoreEvents();