diff --git a/src/corelib/thread/qrunnable.h b/src/corelib/thread/qrunnable.h index e995c69700..80945351ee 100644 --- a/src/corelib/thread/qrunnable.h +++ b/src/corelib/thread/qrunnable.h @@ -42,31 +42,30 @@ private: class QGenericRunnable : public QRunnable { // Type erasure, to only instantiate a non-virtual class per Callable: - class QGenericRunnableHelperBase + class HelperBase { protected: enum class Op { Run, Destroy, }; - using OpFn = void* (*)(Op, QGenericRunnableHelperBase *, void*); + using OpFn = void* (*)(Op, HelperBase *, void*); OpFn fn; protected: - constexpr explicit QGenericRunnableHelperBase(OpFn f) noexcept : fn(f) {} - ~QGenericRunnableHelperBase() = default; + constexpr explicit HelperBase(OpFn f) noexcept : fn(f) {} + ~HelperBase() = default; public: void run() { fn(Op::Run, this, nullptr); } void destroy() { fn(Op::Destroy, this, nullptr); } }; template - class QGenericRunnableHelper : public QGenericRunnableHelperBase, - private QtPrivate::CompactStorage + class Helper : public HelperBase, private QtPrivate::CompactStorage { using Storage = QtPrivate::CompactStorage; - static void *impl(Op op, QGenericRunnableHelperBase *that, [[maybe_unused]] void *arg) + static void *impl(Op op, HelperBase *that, [[maybe_unused]] void *arg) { - const auto _this = static_cast(that); + const auto _this = static_cast(that); switch (op) { case Op::Run: _this->object()(); break; case Op::Destroy: delete _this; break; @@ -75,18 +74,18 @@ class QGenericRunnable : public QRunnable } public: template - explicit QGenericRunnableHelper(UniCallable &&functionToRun) noexcept - : QGenericRunnableHelperBase(&impl), + explicit Helper(UniCallable &&functionToRun) noexcept + : HelperBase(&impl), Storage{std::forward(functionToRun)} { } }; - QGenericRunnableHelperBase *runHelper; + HelperBase *runHelper; public: template = true> explicit QGenericRunnable(Callable &&c) - : runHelper(new QGenericRunnableHelper>(std::forward(c))) + : runHelper(new Helper>(std::forward(c))) { } ~QGenericRunnable() override