From c74134b5b04e97adb2099c16041c415aa62a2231 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 16 Feb 2020 00:34:12 +1100 Subject: [PATCH] viewer: catch ocio exception when creating new processor --- app/widget/viewer/viewerglwidget.cpp | 32 ++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/app/widget/viewer/viewerglwidget.cpp b/app/widget/viewer/viewerglwidget.cpp index 6a9826338..7798731c9 100644 --- a/app/widget/viewer/viewerglwidget.cpp +++ b/app/widget/viewer/viewerglwidget.cpp @@ -20,6 +20,7 @@ #include "viewerglwidget.h" +#include #include #include #include @@ -194,13 +195,32 @@ void ViewerGLWidget::SetupColorProcessor() if (color_manager_) { // (Re)create color processor - color_service_ = ColorProcessor::Create(color_manager_->GetConfig(), OCIO::ROLE_SCENE_LINEAR, ocio_display_, ocio_view_, ocio_look_); - // (Re)create pipeline from color processor - pipeline_ = OpenGLShader::CreateOCIO(context(), - ocio_lut_, - color_service_->GetProcessor(), - true); + try { + ColorProcessorPtr new_service = ColorProcessor::Create(color_manager_->GetConfig(), + OCIO::ROLE_SCENE_LINEAR, + ocio_display_, + ocio_view_, + ocio_look_); + + color_service_ = ColorProcessor::Create(color_manager_->GetConfig(), + OCIO::ROLE_SCENE_LINEAR, + ocio_display_, + ocio_view_, + ocio_look_); + + // (Re)create pipeline from color processor + pipeline_ = OpenGLShader::CreateOCIO(context(), + ocio_lut_, + color_service_->GetProcessor(), + true); + } catch (OCIO::Exception& e) { + QMessageBox::critical(this, + tr("OpenColorIO Error"), + tr("Failed to set color configuration: %1").arg(e.what()), + QMessageBox::Ok); + } + } else { color_service_ = nullptr; pipeline_ = nullptr;