From ccd001fbbdba4ed3937490525871c1475622d007 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Tue, 14 Jul 2009 02:00:56 +0000 Subject: [PATCH] Apply patch to fix #910. Originally committed to SVN as r3128. --- aegisub/src/video_context.cpp | 14 +++++++++++--- aegisub/src/video_context.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp index a0f999dcb..409c23917 100644 --- a/aegisub/src/video_context.cpp +++ b/aegisub/src/video_context.cpp @@ -97,6 +97,7 @@ VideoContext *VideoContext::instance = NULL; VideoContext::VideoContext() { // Set GL context glContext = NULL; + ownGlContext = false; lastTex = 0; lastFrame = -1; yv12shader = 0; @@ -130,7 +131,8 @@ VideoContext::VideoContext() { // Destructor VideoContext::~VideoContext () { Reset(); - delete glContext; + if (ownGlContext) + delete glContext; glContext = NULL; } @@ -483,10 +485,16 @@ wxGLContext *VideoContext::GetGLContext(wxGLCanvas *canvas) { // Also see bug #850. #if wxCHECK_VERSION(2,9,0) #else - if (!glContext) glContext = canvas->GetContext(); + if (!glContext) { + glContext = canvas->GetContext(); + ownGlContext = false; + } #endif #ifndef __WXMAC__ - if (!glContext) glContext = new wxGLContext(canvas); + if (!glContext) { + glContext = new wxGLContext(canvas); + ownGlContext = true; + } #endif return glContext; } diff --git a/aegisub/src/video_context.h b/aegisub/src/video_context.h index ba34a1850..d2c3ec4ad 100644 --- a/aegisub/src/video_context.h +++ b/aegisub/src/video_context.h @@ -85,6 +85,7 @@ private: GLuint lastTex; GLhandleARB yv12shader; int lastFrame; + bool ownGlContext; wxGLContext *glContext; VideoFrameFormat vidFormat; AegiVideoFrame tempFrame;