From 0c7978e1519dd477f4df705407fac122abe34ef2 Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: Dec 16 2020 08:55:13 +0000 Subject: Fix crash on closing OT with floating level strip Co-authored-by: Jeremy Bullock --- diff --git a/toonz/sources/toonz/filmstrip.cpp b/toonz/sources/toonz/filmstrip.cpp index 5c2824c..34ccd67 100644 --- a/toonz/sources/toonz/filmstrip.cpp +++ b/toonz/sources/toonz/filmstrip.cpp @@ -486,7 +486,11 @@ void FilmstripFrames::hideEvent(QHideEvent *) { // active viewer change disconnect(app, SIGNAL(activeViewerChanged()), this, SLOT(getViewer())); - if (m_viewer) { + // if the level strip is floating during shutting down Tahoma2D + // it can cause a crash disconnecting from the viewer which was already + // destroyed. Checking the fps is a janky way to ensure the viewer is + // stil relevant. + if (m_viewer && m_viewer->getFPS() > -100) { disconnect(m_viewer, SIGNAL(onZoomChanged()), this, SLOT(update())); disconnect(m_viewer, SIGNAL(refreshNavi()), this, SLOT(update())); m_viewer = nullptr; diff --git a/toonz/sources/toonz/frameheadgadget.cpp b/toonz/sources/toonz/frameheadgadget.cpp index ce59878..b0400da 100644 --- a/toonz/sources/toonz/frameheadgadget.cpp +++ b/toonz/sources/toonz/frameheadgadget.cpp @@ -600,6 +600,7 @@ void FilmstripFrameHeadGadget::drawShiftTraceMarker(QPainter &p) { //----------------------------------------------------------------------------- bool FilmstripFrameHeadGadget::eventFilter(QObject *obj, QEvent *e) { + if (e->type() != QEvent::MouseButtonPress && e->type() != QEvent::MouseButtonDblClick && e->type() != QEvent::MouseMove) return false; // shift & trace case if (CommandManager::instance()->getAction(MI_ShiftTrace)->isChecked()) return shiftTraceEventFilter(obj, e);