Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix crash on closing OT with floating level strip

Jeremy Bullock0c7978e1519d
diff --git a/toonz/sources/toonz/filmstrip.cpp b/toonz/sources/toonz/filmstrip.cpp
index 5c2824c6c..34ccd674b 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 ce59878e8..b0400dade 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);