Update qpromise_p.h

BUGFIX: prevent events calling functions after qcoreapp shutdown.
This commit is contained in:
Felix Hufnagel 2023-10-17 16:36:44 +02:00 committed by GitHub
parent f382ad25fc
commit 166ec94f27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,7 @@ static void qtpromise_defer(F&& f, const QPointer<QThread>& thread)
{
Event(FType&& f) : QEvent{QEvent::None}, m_f{std::move(f)} { }
Event(const FType& f) : QEvent{QEvent::None}, m_f{f} { }
~Event() override { m_f(); }
~Event() override { if (!QCoreApplication::closingDown()) {m_f();} }
FType m_f;
};