diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-10-19 22:32:59 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-10-20 15:38:48 +0000 |
commit | 4813d84003480f2e2c723fc1ae06071d95f9db66 (patch) | |
tree | 263140e919191bc713a9c46e5e02b9536a989635 /src | |
parent | 87a50b8d0242ad6aa67f474ce0c24eb89bccb656 (diff) |
Fix rendering deadlock for software compositing
With software compositing render thread of Qt's scene graph and Viz's
thread may hit the same mutex inside output surface during frame update.
Fixes: QTBUG-97598
Change-Id: Ic02e161f7b16b22c9099b93f2b1a91e78347975f
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit 0c0d78a6abf68418ae81c202c5576206bd4e5f47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/compositor/display_software_output_surface.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp index 98c104ddf..b811449c9 100644 --- a/src/core/compositor/display_software_output_surface.cpp +++ b/src/core/compositor/display_software_output_surface.cpp @@ -99,9 +99,12 @@ void DisplaySoftwareOutputSurface::Device::Resize(const gfx::Size &sizeInPixels, void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(SwapBuffersCallback swap_ack_callback) { - QMutexLocker locker(&m_mutex); - m_taskRunner = base::ThreadTaskRunnerHandle::Get(); - m_swapCompletionCallback = std::move(swap_ack_callback); + { // MEMO don't hold a lock together with an 'observer', as the call from Qt's scene graph may come at the same time + QMutexLocker locker(&m_mutex); + m_taskRunner = base::ThreadTaskRunnerHandle::Get(); + m_swapCompletionCallback = std::move(swap_ack_callback); + } + if (auto obs = observer()) obs->readyToSwap(); } |