fix crash on launch with shrinked imageviewer

This commit is contained in:
shun-iwasawa 2021-03-22 18:54:46 +09:00 committed by manongjohn
parent 2b95cf72d0
commit c6848d2175
3 changed files with 12 additions and 0 deletions

View file

@ -1345,6 +1345,8 @@ void ImageViewer::onContextAboutToBeDestroyed() {
makeCurrent(); makeCurrent();
m_lutCalibrator->cleanup(); m_lutCalibrator->cleanup();
doneCurrent(); doneCurrent();
disconnect(context(), SIGNAL(aboutToBeDestroyed()), this,
SLOT(onContextAboutToBeDestroyed()));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1352,6 +1354,9 @@ void ImageViewer::onContextAboutToBeDestroyed() {
void ImageViewer::onPreferenceChanged(const QString& prefName) { void ImageViewer::onPreferenceChanged(const QString& prefName) {
if (prefName == "ColorCalibration") { if (prefName == "ColorCalibration") {
if (Preferences::instance()->isColorCalibrationEnabled()) { 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(); makeCurrent();
if (!m_lutCalibrator) if (!m_lutCalibrator)
m_lutCalibrator = new LutCalibrator(); m_lutCalibrator = new LutCalibrator();

View file

@ -1209,6 +1209,9 @@ void SceneViewer::onStopMotionLiveViewStopped() {
void SceneViewer::onPreferenceChanged(const QString &prefName) { void SceneViewer::onPreferenceChanged(const QString &prefName) {
if (prefName == "ColorCalibration") { if (prefName == "ColorCalibration") {
if (Preferences::instance()->isColorCalibrationEnabled()) { 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(); makeCurrent();
if (!m_lutCalibrator) if (!m_lutCalibrator)
m_lutCalibrator = new LutCalibrator(); m_lutCalibrator = new LutCalibrator();
@ -3555,6 +3558,8 @@ void SceneViewer::onContextAboutToBeDestroyed() {
makeCurrent(); makeCurrent();
m_lutCalibrator->cleanup(); m_lutCalibrator->cleanup();
doneCurrent(); doneCurrent();
disconnect(context(), SIGNAL(aboutToBeDestroyed()), this,
SLOT(onContextAboutToBeDestroyed()));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -989,6 +989,8 @@ void HexagonalColorWheel::onContextAboutToBeDestroyed() {
makeCurrent(); makeCurrent();
m_lutCalibrator->cleanup(); m_lutCalibrator->cleanup();
doneCurrent(); doneCurrent();
disconnect(context(), SIGNAL(aboutToBeDestroyed()), this,
SLOT(onContextAboutToBeDestroyed()));
} }
//***************************************************************************** //*****************************************************************************