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

Proposed by Gerry Boland
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
Ubuntu Phablet Team Pending
Review via email: mp+319691@code.launchpad.net

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

Typo

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

You may drop the prerequisite now.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
381. By Gerry Boland

Add required header

382. By Gerry Boland

Shrink diff slightly

383. By Gerry Boland

Missing close quote

384. By Gerry Boland

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
=== modified file 'src/ubuntumirclient/qmirclientbackingstore.cpp'
--- src/ubuntumirclient/qmirclientbackingstore.cpp 2017-02-21 13:23:47 +0000
+++ src/ubuntumirclient/qmirclientbackingstore.cpp 2017-03-13 13:44:33 +0000
@@ -61,12 +61,22 @@
6161
62QMirClientBackingStore::~QMirClientBackingStore()62QMirClientBackingStore::~QMirClientBackingStore()
63{63{
64 // Paraphrasing QOpenGLCompositorBackingStore: "With render-to-texture-widgets QWidget makes64 if (!mTexture->isCreated())
65 return;
66
67 // According to QOpenGLCompositorBackingStore: "With render-to-texture-widgets QWidget makes
65 // sure the context is made current before destroying backingstores. That is however not the68 // sure the context is made current before destroying backingstores. That is however not the
66 // case for windows with regular widgets only.69 // case for windows with regular widgets only.
67 if (!QOpenGLContext::currentContext()) {70 auto context = QOpenGLContext::currentContext();
68 mContext->makeCurrent(window());71 QScopedPointer<QOffscreenSurface> tempSurface;
72 if (!context) { // QWindow's backing QPlatformSurface probably gone, use temp one for cleanup
73 tempSurface.reset(new QOffscreenSurface);
74 tempSurface->setFormat(mContext->format());
75 tempSurface->create();
76 mContext->makeCurrent(tempSurface.data());
69 }77 }
78 // QOpenGLTexture will go out of scope, is then deleted. Then QOpenGLContext falls out of
79 // scope, calls doneCurrent and is then deleted.
70}80}
7181
72void QMirClientBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset)82void QMirClientBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset)

Subscribers

People subscribed via source and target branches