The QOpenGLBuffers used by QOpenGL2PaintEngineEx are tied to a specific share group on creation, via QOpenGLSharedResourceGuard. If QOpenGL2PaintEngineEx is later used with a recreated QOpenGLContext, that happens to live at the same address as the previous one, we will fail to detect that the context has changed by using a naked pointer comparison (ABA problem). If the share group of the new context is different, this will cause problems down the line in QOpenGLBuffers::bind(). This scenario has been observed on Android, where the context created in QOpenGLWidgetPrivate::initialize() ends up with the same address, but then adopts a new share context from RHI, because the widget has been moved to a different top level window. To remedy this, we store the QOpenGL2PaintEngineEx's cached context via a QPointer, so that we pick up the B state of ABA (null), and correctly throw away the old buffers in QOpenGL2PaintEngineEx::begin. Change-Id: I5c221a37fd95f846d96e72509bba54f3d10fee3a Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 8f6b27fdeef4f45d70c7bc93f7393f58f5ddeb16) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%