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 acf646b3a9
commit f63936f7f6
2 changed files with 10 additions and 4 deletions

View File

@ -2641,6 +2641,9 @@ protected:
public:
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
@ -2683,10 +2686,6 @@ public:
virtual void ReleaseSurface() {}
// Mark this context as destroyed. This will nullptr out all
// the GL function pointers!
void MarkDestroyed();
bool IsDestroyed() {
// MarkDestroyed will mark all these as null.
return mSymbols.fUseProgram == nullptr;

View File

@ -173,6 +173,13 @@ CompositorOGL::CleanupResources()
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;
}