Bug 1059793 - Mark the compositor's gl context destroyed before the widget is gone. r=jgilbert

This commit is contained in:
Nicolas Silva 2014-09-02 14:05:00 +02:00
parent ae9a45a6fd
commit d9c2fd4a31
2 changed files with 10 additions and 4 deletions

View File

@ -2641,6 +2641,9 @@ protected:
public: public:
virtual ~GLContext(); virtual ~GLContext();
// Mark this context as destroyed. This will nullptr out all
// the GL function pointers!
void MarkDestroyed();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Everything that isn't standard GL APIs // Everything that isn't standard GL APIs
@ -2683,10 +2686,6 @@ public:
virtual void ReleaseSurface() {} virtual void ReleaseSurface() {}
// Mark this context as destroyed. This will nullptr out all
// the GL function pointers!
void MarkDestroyed();
bool IsDestroyed() { bool IsDestroyed() {
// MarkDestroyed will mark all these as null. // MarkDestroyed will mark all these as null.
return mSymbols.fUseProgram == nullptr; return mSymbols.fUseProgram == nullptr;

View File

@ -173,6 +173,13 @@ CompositorOGL::CleanupResources()
mQuadVBO = 0; mQuadVBO = 0;
} }
// On the main thread the Widget will be destroyed soon and calling MakeCurrent
// after that could cause a crash (at least with GLX, see bug 1059793), unless
// context is marked as destroyed.
// There may be some textures still alive that will try to call MakeCurrent on
// the context so let's make sure it is marked destroyed now.
mGLContext->MarkDestroyed();
mGLContext = nullptr; mGLContext = nullptr;
} }