Merge lp:~gerboland/qtubuntu/fix-test-crash-backingstore into lp:qtubuntu

Proposed by Gerry Boland on 2017-03-13
Status: Superseded
Proposed branch: lp:~gerboland/qtubuntu/fix-test-crash-backingstore
Merge into: lp:qtubuntu
Prerequisite: lp:~ci-train-bot/qtubuntu/qtubuntu-ubuntu-zesty-2481
Diff against target: 29 lines (+13/-3)
1 file modified
src/ubuntumirclient/qmirclientbackingstore.cpp (+13/-3)
To merge this branch: bzr merge lp:~gerboland/qtubuntu/fix-test-crash-backingstore
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing on 2017-03-13
Ubuntu Phablet Team 2017-03-13 Pending
Review via email:

This proposal has been superseded by a proposal from 2017-03-13.

Commit message

BackingStore: is possible for context's QPlatformSurface to be deleted before backing store is.

On destruction, check if there is a current context, and if not, it is likely the QWindow's original QPlatformSurface has been deleted. To clean up properly, need to create a temporary QOffscreenSurface, which can then acquire the GL context and delete the texture safely.

To post a comment you must log in.
380. By Gerry Boland on 2017-03-13


Daniel d'Andrada (dandrader) wrote :

You may drop the prerequisite now.

381. By Gerry Boland on 2017-03-13

Add required header

382. By Gerry Boland on 2017-03-13

Shrink diff slightly

383. By Gerry Boland on 2017-03-13

Missing close quote

384. By Gerry Boland on 2017-03-24

QOffScreenSurface on stack instead of heap

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntumirclient/qmirclientbackingstore.cpp'
2--- src/ubuntumirclient/qmirclientbackingstore.cpp 2017-02-21 13:23:47 +0000
3+++ src/ubuntumirclient/qmirclientbackingstore.cpp 2017-03-13 13:44:33 +0000
4@@ -61,12 +61,22 @@
6 QMirClientBackingStore::~QMirClientBackingStore()
7 {
8- // Paraphrasing QOpenGLCompositorBackingStore: "With render-to-texture-widgets QWidget makes
9+ if (!mTexture->isCreated())
10+ return;
12+ // According to QOpenGLCompositorBackingStore: "With render-to-texture-widgets QWidget makes
13 // sure the context is made current before destroying backingstores. That is however not the
14 // case for windows with regular widgets only.
15- if (!QOpenGLContext::currentContext()) {
16- mContext->makeCurrent(window());
17+ auto context = QOpenGLContext::currentContext();
18+ QScopedPointer<QOffscreenSurface> tempSurface;
19+ if (!context) { // QWindow's backing QPlatformSurface probably gone, use temp one for cleanup
20+ tempSurface.reset(new QOffscreenSurface);
21+ tempSurface->setFormat(mContext->format());
22+ tempSurface->create();
23+ mContext->makeCurrent(;
24 }
25+ // QOpenGLTexture will go out of scope, is then deleted. Then QOpenGLContext falls out of
26+ // scope, calls doneCurrent and is then deleted.
27 }
29 void QMirClientBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset)


People subscribed via source and target branches