De-inline QGenericRunnable overrides
Pins the vtable to a single TU and therefore prevents duplicate vtables, -Wweak-vtables warnings and false-positive dynamic_casts. This requires exporting QGenericRunnable, which hopefully won't also export the nested class. Pick-to: 6.6 Task-number: QTBUG-45582 Change-Id: Ie1f29d25b0dcdee7654c33c497e8e0350d12e311 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
7a31911b79
commit
be1b589cb9
@ -21,6 +21,17 @@ QRunnable *QRunnable::warnNullCallable()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
QRunnable::QGenericRunnable::~QGenericRunnable()
|
||||
{
|
||||
runHelper->destroy();
|
||||
}
|
||||
|
||||
void QRunnable::QGenericRunnable::run()
|
||||
{
|
||||
runHelper->run();
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QRunnable
|
||||
\inmodule QtCore
|
||||
|
@ -42,7 +42,7 @@ private:
|
||||
class QGenericRunnable;
|
||||
};
|
||||
|
||||
class QRunnable::QGenericRunnable : public QRunnable
|
||||
class Q_CORE_EXPORT QRunnable::QGenericRunnable : public QRunnable
|
||||
{
|
||||
// Type erasure, to only instantiate a non-virtual class per Callable:
|
||||
class HelperBase
|
||||
@ -91,14 +91,9 @@ public:
|
||||
: runHelper(new Helper<std::decay_t<Callable>>(std::forward<Callable>(c)))
|
||||
{
|
||||
}
|
||||
~QGenericRunnable() override
|
||||
{
|
||||
runHelper->destroy();
|
||||
}
|
||||
void run() override
|
||||
{
|
||||
runHelper->run();
|
||||
}
|
||||
~QGenericRunnable() override;
|
||||
|
||||
void run() override;
|
||||
};
|
||||
|
||||
namespace QtPrivate {
|
||||
|
Loading…
Reference in New Issue
Block a user