Skip to content

Commit 898eea2

Browse files
[BitmapTexture] Check EGL context before destruction
Destroying GL resources without EGL context bound is not safe and may lead to crash.
1 parent 26ab43e commit 898eea2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ void BitmapTexture::bindAsSurface()
288288

289289
BitmapTexture::~BitmapTexture()
290290
{
291+
GLContext* currentContext = GLContext::current();
292+
if (!currentContext || !currentContext->platformContext()) {
293+
// The context has been destroyed already, so we can't clean up.
294+
return;
295+
}
296+
291297
glDeleteTextures(1, &m_id);
292298

293299
if (m_fbo)

0 commit comments

Comments
 (0)