From 3747705a4395fd38a20736cfa630f94e07f95831 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 4 Oct 2015 18:19:02 -0700 Subject: [PATCH] Select the OpenGL context when destroying VideoDisplay This is needed to destroy the correct things when there are multiple active opengl displays. --- src/video_display.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video_display.cpp b/src/video_display.cpp index 083307185..2df9ec3c0 100644 --- a/src/video_display.cpp +++ b/src/video_display.cpp @@ -126,6 +126,7 @@ VideoDisplay::VideoDisplay(wxToolBar *toolbar, bool freeSize, wxComboBox *zoomBo } VideoDisplay::~VideoDisplay () { + Unload(); con->videoController->Unbind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this); } @@ -435,8 +436,11 @@ Vector2D VideoDisplay::GetMousePosition() const { } void VideoDisplay::Unload() { - glContext.reset(); + if (glContext) { + SetCurrent(*glContext); + } videoOut.reset(); tool.reset(); + glContext.reset(); pending_frame.reset(); }