Fix GUI/render-thread data race in canvas-painter 2D renderers
The USE_PAINTER_BACKEND rendering path draws every frame on the Qt
Quick render thread via QCPainterItemRenderer::paint(), which
dispatched straight into each renderer's live, GUI-owned containers
(m_seriesData, m_activeSlices, m_groups) and live QQuickItem pointers/
z() values. Those same containers are mutated on the GUI thread during
handlePolish(), with no synchronization between the two threads, and
the dispatcher could also observe renderer QQuickItems mid-destruction.
Give each renderer (Area, Bars, Pie, Point) a synchronizeData()
method that snapshots its paint-relevant, GUI-owned state into a
plain-value/COW container at the Qt Quick sync point, the one place
per frame where the GUI thread is guaranteed blocked. Rework each
canvasPaint() into a static paintSnapshot() that reads only that
snapshot, never live series/theme objects. In the top-level dispatcher
(QCPainterItemRenderer), replace the live renderer-pointer array with
RendererSlot entries (kind/z/alive) recorded once in synchronizeData()
and consumed by paint() purely by value, so paint() never dereferences
a renderer that the GUI thread may be tearing down.
CustomRenderer requires more work than the other renders. Therefore,
it's more suitable to do in a follow-up.
[ChangeLog][Graphs2D] 2D graphs can now be rendered with
QCanvasPainter.
Amends 03e677e12594c10e9658b1bbed695512359c9564.
Pick-to: 6.12
Task-number: QTBUG-148186
Task-number: QTBUG-146286
Change-Id: I3bcfb1fbea17dca080e30510855bca9588d359c5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>