Fix crash when quitting with floating levelstrip

This commit is contained in:
manongjohn 2021-03-13 08:48:52 -05:00
parent e70e7ead32
commit 0f1e0ff430
4 changed files with 22 additions and 14 deletions

View file

@ -486,25 +486,27 @@ void FilmstripFrames::hideEvent(QHideEvent *) {
// active viewer change
disconnect(app, SIGNAL(activeViewerChanged()), this, SLOT(getViewer()));
// if the level strip is floating during shutting down Tahoma2D
// it can cause a crash disconnecting from the viewer which was already
// destroyed.
if (m_viewer && m_viewer->isValid()) {
disconnectViewer();
}
//-----------------------------------------------------------------------------
void FilmstripFrames::disconnectViewer() {
if (!m_viewer) return;
disconnect(m_viewer, SIGNAL(onZoomChanged()), this, SLOT(update()));
disconnect(m_viewer, SIGNAL(refreshNavi()), this, SLOT(update()));
disconnect(m_viewer, SIGNAL(viewerDestructing()), this,
SLOT(disconnectViewer()));
m_viewer = nullptr;
}
}
//-----------------------------------------------------------------------------
void FilmstripFrames::getViewer() {
bool viewerChanged = false;
if (m_viewer != TApp::instance()->getActiveViewer()) {
if (m_viewer) {
disconnect(m_viewer, SIGNAL(onZoomChanged()), this, SLOT(update()));
disconnect(m_viewer, SIGNAL(refreshNavi()), this, SLOT(update()));
}
disconnectViewer();
viewerChanged = true;
}
@ -513,6 +515,8 @@ void FilmstripFrames::getViewer() {
if (m_viewer && viewerChanged) {
connect(m_viewer, SIGNAL(onZoomChanged()), this, SLOT(update()));
connect(m_viewer, SIGNAL(refreshNavi()), this, SLOT(update()));
connect(m_viewer, SIGNAL(viewerDestructing()), this,
SLOT(disconnectViewer()));
update();
}
}

View file

@ -172,6 +172,7 @@ protected slots:
void comboBoxToggled(bool);
void navigatorToggled(bool);
void levelSelected(int);
void disconnectViewer();
private:
// QSS Properties

View file

@ -852,6 +852,8 @@ SceneViewer::~SceneViewer() {
int ret = l_contexts.erase(m_currentContext);
if (ret) TGLDisplayListsManager::instance()->releaseContext(m_currentContext);
emit viewerDestructing();
}
//-------------------------------------------------------------------------------

View file

@ -498,6 +498,7 @@ signals:
void refreshNavi();
// for updating the titlebar
void previewToggled();
void viewerDestructing();
};
// Functions