QSurfaceCaptureGrabber: fix cross-thread access to grabbing timer
The grabbing timer lives on the grabbing thread, but
updateTimerInterval() could run on any thread reporting an error,
e.g. the PipeWire portal failure path on the main thread. Touching
a running QChronoTimer from another thread warns about timers and
races with context teardown.
Marshal interval updates to the timer's own thread with a queued
invocation, guard the remaining shared state with a mutex, and drop
stale updates via a generation counter bumped on init and finalize.
The frame rate itself is no longer shared: setFrameRate() runs on the
owning thread only, the rate is snapshotted in start() for the upcoming
stream, and the grabbing thread reads its own copy.
Pick-to: 6.12
Task-number: QTBUG-151052
Change-Id: Ic4bfc62bf80b3596d723786fa7594659ba1db7b1
Reviewed-by: Nils Petter Skålerud <nils.petter.skalerud@qt.io>
| commit | 65333baa17f73bebd93efb98acdb4bc8e6ccd9c8 |
| parent | eb5cb75141a296f5dd8116ab97b3650dbd90fef0 |
| author | Tim Blechmann <tim.blechmann@qt.io> |
| committer | Tim Blechmann <tim.blechmann@qt.io> |
| commit time | Thu, 8 Oct 2026 00:59:42 +0000 |
- M src/multimedia/pipewire/qpipewire_screencapture.cpp
- M src/multimedia/pipewire/qpipewire_screencapturehelper.cpp
- M src/multimedia/qsurfacecapturegrabber.cpp
- M src/multimedia/qsurfacecapturegrabber_p.h
- M src/multimediatestlib/qfakexdgportalfixture.cpp
- M src/multimediatestlib/qfakexdgportalfixture_p.h
- M src/plugins/multimedia/ffmpeg/qeglfsscreencapture.cpp
- M src/plugins/multimedia/ffmpeg/qffmpegscreencapture_dxgi.cpp
- M src/plugins/multimedia/ffmpeg/qffmpegwindowcapture_uwp.cpp
- M src/plugins/multimedia/ffmpeg/qgdiwindowcapture.cpp
- M src/plugins/multimedia/ffmpeg/qgrabwindowsurfacecapture.cpp
- M src/plugins/multimedia/ffmpeg/qx11surfacecapture.cpp
- M tests/auto/integration/qscreencapturebackend/tst_qscreencapturebackend.cpp