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

Proposed by Gerry Boland
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 384
Merged at revision: 386
Proposed branch: lp:~gerboland/qtubuntu/fix-test-crash-backingstore
Merge into: lp:qtubuntu
Diff against target: 36 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
Daniel d'Andrada (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+319695@code.launchpad.net

This proposal supersedes 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.

Description of the change

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

You may drop the prerequisite now.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
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

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:381
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/202/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4410
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4438
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4271/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4271/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4271/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4271/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4271/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4271/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/202/rebuild

review: Approve (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:383
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/203/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4413
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4441
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4274/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/203/rebuild

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

This isn't easy to test really. I had to apply this patch to Qt upstream to fix QWindow unit tests crashing.

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

I might be missing something, but is there a reason why the tempSurface declaration is outside the if(!context){} block?

review: Needs Information
Revision history for this message
Gerry Boland (gerboland) wrote :

You're right, it can be brought in, fixing

Revision history for this message
Gerry Boland (gerboland) wrote :

Delay because actually bringing the tempSurface inside the if block causes crashes again. Unsure why

384. By Gerry Boland

QOffScreenSurface on stack instead of heap

Revision history for this message
Gerry Boland (gerboland) wrote :

Nope, it is ok. Crash was due to something else.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:384
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/213/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4685
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4713
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4536
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4536/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4536
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4536/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4536
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4536/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4536
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4536/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4536
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4536/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4536
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4536/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/213/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

* Did CI run pass? If not, please explain why.
Yes

review: Approve

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-24 15:27:00 +0000
@@ -40,6 +40,7 @@
4040
41#include "qmirclientbackingstore.h"41#include "qmirclientbackingstore.h"
42#include "qmirclientlogging.h"42#include "qmirclientlogging.h"
43#include <QtGui/QOffscreenSurface>
43#include <QtGui/QOpenGLContext>44#include <QtGui/QOpenGLContext>
44#include <QtGui/QOpenGLTexture>45#include <QtGui/QOpenGLTexture>
45#include <QtGui/QMatrix4x4>46#include <QtGui/QMatrix4x4>
@@ -61,12 +62,21 @@
6162
62QMirClientBackingStore::~QMirClientBackingStore()63QMirClientBackingStore::~QMirClientBackingStore()
63{64{
65 if (!mTexture->isCreated())
66 return;
67
64 // Paraphrasing QOpenGLCompositorBackingStore: "With render-to-texture-widgets QWidget makes68 // Paraphrasing QOpenGLCompositorBackingStore: "With render-to-texture-widgets QWidget makes
65 // sure the context is made current before destroying backingstores. That is however not the69 // sure the context is made current before destroying backingstores. That is however not the
66 // case for windows with regular widgets only.70 // case for windows with regular widgets only."
67 if (!QOpenGLContext::currentContext()) {71 auto context = QOpenGLContext::currentContext();
68 mContext->makeCurrent(window());72 if (!context) { // QWindow's backing QPlatformSurface probably gone, use temp one for cleanup
73 QOffscreenSurface tempSurface;
74 tempSurface.setFormat(mContext->format());
75 tempSurface.create();
76 mContext->makeCurrent(&tempSurface);
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