diff --git a/toonz/sources/toonz/imageviewer.cpp b/toonz/sources/toonz/imageviewer.cpp index 7820a23..85f3902 100644 --- a/toonz/sources/toonz/imageviewer.cpp +++ b/toonz/sources/toonz/imageviewer.cpp @@ -1345,6 +1345,8 @@ void ImageViewer::onContextAboutToBeDestroyed() { makeCurrent(); m_lutCalibrator->cleanup(); doneCurrent(); + disconnect(context(), SIGNAL(aboutToBeDestroyed()), this, + SLOT(onContextAboutToBeDestroyed())); } //----------------------------------------------------------------------------- @@ -1352,6 +1354,9 @@ void ImageViewer::onContextAboutToBeDestroyed() { void ImageViewer::onPreferenceChanged(const QString &prefName) { if (prefName == "ColorCalibration") { if (Preferences::instance()->isColorCalibrationEnabled()) { + // if the window is so shriked that the gl widget is empty, + // showEvent can be called before creating the context. + if (!context()) return; makeCurrent(); if (!m_lutCalibrator) m_lutCalibrator = new LutCalibrator(); diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index 0a58169..799d42f 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -1201,6 +1201,9 @@ void SceneViewer::onStopMotionLiveViewStopped() { void SceneViewer::onPreferenceChanged(const QString &prefName) { if (prefName == "ColorCalibration") { if (Preferences::instance()->isColorCalibrationEnabled()) { + // if the window is so shriked that the gl widget is empty, + // showEvent can be called before creating the context. + if (!context()) return; makeCurrent(); if (!m_lutCalibrator) m_lutCalibrator = new LutCalibrator(); @@ -3271,6 +3274,8 @@ void SceneViewer::onContextAboutToBeDestroyed() { makeCurrent(); m_lutCalibrator->cleanup(); doneCurrent(); + disconnect(context(), SIGNAL(aboutToBeDestroyed()), this, + SLOT(onContextAboutToBeDestroyed())); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index 4d01f35..e05508a 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -900,6 +900,8 @@ void HexagonalColorWheel::onContextAboutToBeDestroyed() { makeCurrent(); m_lutCalibrator->cleanup(); doneCurrent(); + disconnect(context(), SIGNAL(aboutToBeDestroyed()), this, + SLOT(onContextAboutToBeDestroyed())); } //*****************************************************************************