Apply patch to fix #910.

Originally committed to SVN as r3128.
This commit is contained in:
Niels Martin Hansen 2009-07-14 02:00:56 +00:00
parent 543fd177d5
commit 68481215c9
2 changed files with 12 additions and 3 deletions

View File

@ -97,6 +97,7 @@ VideoContext *VideoContext::instance = NULL;
VideoContext::VideoContext() { VideoContext::VideoContext() {
// Set GL context // Set GL context
glContext = NULL; glContext = NULL;
ownGlContext = false;
lastTex = 0; lastTex = 0;
lastFrame = -1; lastFrame = -1;
yv12shader = 0; yv12shader = 0;
@ -130,7 +131,8 @@ VideoContext::VideoContext() {
// Destructor // Destructor
VideoContext::~VideoContext () { VideoContext::~VideoContext () {
Reset(); Reset();
delete glContext; if (ownGlContext)
delete glContext;
glContext = NULL; glContext = NULL;
} }
@ -483,10 +485,16 @@ wxGLContext *VideoContext::GetGLContext(wxGLCanvas *canvas) {
// Also see bug #850. // Also see bug #850.
#if wxCHECK_VERSION(2,9,0) #if wxCHECK_VERSION(2,9,0)
#else #else
if (!glContext) glContext = canvas->GetContext(); if (!glContext) {
glContext = canvas->GetContext();
ownGlContext = false;
}
#endif #endif
#ifndef __WXMAC__ #ifndef __WXMAC__
if (!glContext) glContext = new wxGLContext(canvas); if (!glContext) {
glContext = new wxGLContext(canvas);
ownGlContext = true;
}
#endif #endif
return glContext; return glContext;
} }

View File

@ -85,6 +85,7 @@ private:
GLuint lastTex; GLuint lastTex;
GLhandleARB yv12shader; GLhandleARB yv12shader;
int lastFrame; int lastFrame;
bool ownGlContext;
wxGLContext *glContext; wxGLContext *glContext;
VideoFrameFormat vidFormat; VideoFrameFormat vidFormat;
AegiVideoFrame tempFrame; AegiVideoFrame tempFrame;