mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1659681 - Avoid crash in ~SharedSurace_SurfaceTexture() when GLContext is lost r=sotaro,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D88889
This commit is contained in:
parent
27494fab83
commit
665c0bd32e
@ -162,7 +162,8 @@ SharedSurface_SurfaceTexture::SharedSurface_SurfaceTexture(
|
||||
const EGLSurface eglSurface)
|
||||
: SharedSurface(desc, nullptr),
|
||||
mSurface(surface),
|
||||
mEglSurface(eglSurface) {}
|
||||
mEglSurface(eglSurface),
|
||||
mEglDisplay(GLContextEGL::Cast(desc.gl)->mEgl) {}
|
||||
|
||||
SharedSurface_SurfaceTexture::~SharedSurface_SurfaceTexture() {
|
||||
if (mOrigEglSurface) {
|
||||
@ -171,9 +172,11 @@ SharedSurface_SurfaceTexture::~SharedSurface_SurfaceTexture() {
|
||||
// to the surface.
|
||||
UnlockProd();
|
||||
}
|
||||
const auto& gle = GLContextEGL::Cast(mDesc.gl);
|
||||
const auto& egl = gle->mEgl;
|
||||
egl->fDestroySurface(mEglSurface);
|
||||
|
||||
std::shared_ptr<EglDisplay> display = mEglDisplay.lock();
|
||||
if (display) {
|
||||
display->fDestroySurface(mEglSurface);
|
||||
}
|
||||
java::SurfaceAllocator::DisposeSurface(mSurface);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
# include "AndroidNativeWindow.h"
|
||||
# include "GLLibraryEGL.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
@ -76,6 +77,7 @@ class SurfaceFactory_EGLImage final : public SurfaceFactory {
|
||||
class SharedSurface_SurfaceTexture final : public SharedSurface {
|
||||
const java::GeckoSurface::GlobalRef mSurface;
|
||||
const EGLSurface mEglSurface;
|
||||
const std::weak_ptr<EglDisplay> mEglDisplay;
|
||||
EGLSurface mOrigEglSurface = 0;
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user