From 37a725b06dc8b9bc183609a2077ec54602c939bf Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Mon, 28 Mar 2016 12:12:52 -0700 Subject: [PATCH] Fallback to desktop if display plugin fails --- interface/src/Application.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9bef698167..7f2d1d2af5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4892,7 +4892,17 @@ void Application::updateDisplayMode() { // FIXME probably excessive and useless context switching _offscreenContext->makeCurrent(); - newDisplayPlugin->activate(); + + // If the new plugin fails to activate, fallback to first item on the list + if (!newDisplayPlugin->activate()) { + qWarning() << "Failed to activate plugin: " << newDisplayPlugin->getName(); + newDisplayPlugin = displayPlugins.at(0); + qWarning() << "Activating fallback plugin: " << newDisplayPlugin->getName(); + if (!newDisplayPlugin->activate()) { + qFatal("Failed to activate fallback plugin"); + } + } + _offscreenContext->makeCurrent(); offscreenUi->resize(fromGlm(newDisplayPlugin->getRecommendedUiSize())); _offscreenContext->makeCurrent();