diff options
Diffstat (limited to 'dev-qt/qtcore/files/qtcore-5.15.8-fix-crash-w-debug.patch')
-rw-r--r-- | dev-qt/qtcore/files/qtcore-5.15.8-fix-crash-w-debug.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/dev-qt/qtcore/files/qtcore-5.15.8-fix-crash-w-debug.patch b/dev-qt/qtcore/files/qtcore-5.15.8-fix-crash-w-debug.patch new file mode 100644 index 000000000000..74f5ed5c4886 --- /dev/null +++ b/dev-qt/qtcore/files/qtcore-5.15.8-fix-crash-w-debug.patch @@ -0,0 +1,41 @@ +From 0c0b34badb8a56f5c0d7d43c3847508774c8e553 Mon Sep 17 00:00:00 2001 +From: Harald Sitter <sitter@kde.org> +Date: Mon, 2 Jan 2023 12:38:02 +0100 +Subject: [PATCH] correctly set up ref counting in + QThreadPool::tryStart(std::function) + +this function was inconsistent with the QThreadPool::tryStart(QRunnable) +overload, where ref counting does get set up correctly. the lack of ref +counting setup would later cause trouble because we assert the ref +counting state all over QThreadPool. to prevent failed assertions we +correctly set up ref counting now. + +this change is not applicable to Qt6 because the ref counting has +already been removed there: +https://github.com/qt/qtbase/commit/ecfda98d1f91c6a7da0d89826558d856cd88e670 + +BUG: 449688 +--- + src/corelib/thread/qthreadpool.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp +index 40cc646519..8aa06a4c8f 100644 +--- a/src/corelib/thread/qthreadpool.cpp ++++ b/src/corelib/thread/qthreadpool.cpp +@@ -602,8 +602,12 @@ bool QThreadPool::tryStart(std::function<void()> functionToRun) + return false; + + QRunnable *runnable = QRunnable::create(std::move(functionToRun)); ++ Q_ASSERT(runnable->ref == 0); ++ ++runnable->ref; + if (d->tryStart(runnable)) + return true; ++ --runnable->ref; ++ Q_ASSERT(runnable->ref == 0); + delete runnable; + return false; + } +-- +GitLab + |