From 973ee544fbce105b948d7bcb205195ea24704ae5 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Tue, 11 Oct 2016 16:36:29 -0700 Subject: [PATCH] Prevent crashes in openvr on shutdown By ensuring that there is an opengl context is bound before calling VR_Shutdown() --- plugins/openvr/src/OpenVrDisplayPlugin.cpp | 3 ++- plugins/openvr/src/ViveControllerManager.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index 68bb23a84d..212f1ce46d 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -445,8 +445,9 @@ void OpenVrDisplayPlugin::internalDeactivate() { _openVrDisplayActive = false; _container->setIsOptionChecked(StandingHMDSensorMode, false); if (_system) { - // Invalidate poses. It's fine if someone else sets these shared values, but we're about to stop updating them, and + // TODO: Invalidate poses. It's fine if someone else sets these shared values, but we're about to stop updating them, and // we don't want ViveControllerManager to consider old values to be valid. + _container->makeRenderingContextCurrent(); releaseOpenVrSystem(); _system = nullptr; } diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index bcfc7170dc..2d2720e388 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -132,6 +132,7 @@ void ViveControllerManager::deactivate() { _container->removeMenu(MENU_PATH); if (_system) { + _container->makeRenderingContextCurrent(); releaseOpenVrSystem(); _system = nullptr; }