From 14580c6f251cadb7e7ee2bb3a06c10cdab60b6a2 Mon Sep 17 00:00:00 2001 From: Rodney Date: Nov 10 2020 16:37:13 +0000 Subject: Merge pull request #3583 from shun-iwasawa/g/fix_crash_on_switching_rooms Fix Crash on Switching Rooms --- diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h index be48cd3..25f0e54 100644 --- a/toonz/sources/include/toonzqt/styleeditor.h +++ b/toonz/sources/include/toonzqt/styleeditor.h @@ -152,7 +152,8 @@ class DVAPI HexagonalColorWheel final : public GLWidgetForHighDpi { QOpenGLFramebufferObject *m_fbo = NULL; LutCalibrator *m_lutCalibrator = NULL; - bool m_firstInitialized = true; + bool m_firstInitialized = true; + bool m_cuedCalibrationUpdate = false; private: void drawCurrentColorMark(); @@ -169,6 +170,7 @@ public: QColor getBGColor() const { return m_bgColor; } void updateColorCalibration(); + void cueCalibrationUpdate() { m_cuedCalibrationUpdate = true; } protected: void initializeGL() override; @@ -180,6 +182,7 @@ protected: void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; + void showEvent(QShowEvent *) override; signals: void colorChanged(const ColorModel &color, bool isDragging); diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index fe10549..095b00a 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -596,6 +596,15 @@ void HexagonalColorWheel::updateColorCalibration() { //----------------------------------------------------------------------------- +void HexagonalColorWheel::showEvent(QShowEvent *) { + if (m_cuedCalibrationUpdate) { + updateColorCalibration(); + m_cuedCalibrationUpdate = false; + } +} + +//----------------------------------------------------------------------------- + void HexagonalColorWheel::initializeGL() { initializeOpenGLFunctions(); @@ -1716,7 +1725,10 @@ void PlainColorPage::setSplitterState(QByteArray state) { //----------------------------------------------------------------------------- void PlainColorPage::updateColorCalibration() { - m_hexagonalColorWheel->updateColorCalibration(); + if (m_hexagonalColorWheel->isVisible()) + m_hexagonalColorWheel->updateColorCalibration(); + else + m_hexagonalColorWheel->cueCalibrationUpdate(); } //-----------------------------------------------------------------------------