diff --git a/src/video_display.cpp b/src/video_display.cpp
index 083307185e9ca6796c7c89346b978b87fd0b09c0..2df9ec3c05e4cf0f5d40cbbe1e49bd5c5b2a321a 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();
 }