viewer: add watcher destroyed slot

Prevents crashes
This commit is contained in:
itsmattkc
2022-06-06 20:17:28 -07:00
parent 393f0105dc
commit 6bc84e00ae
2 changed files with 11 additions and 0 deletions
+9
View File
@@ -530,6 +530,14 @@ void ViewerWidget::CreateAddableAt(const QRectF &f)
}
}
void ViewerWidget::HandleFirstRequeueDestroy()
{
// Extra protection to ensure we don't reference a destroyed object
if (first_requeue_watcher_ == sender()) {
first_requeue_watcher_ = nullptr;
}
}
void ViewerWidget::CloseAudioProcessor()
{
audio_processor_.Close();
@@ -676,6 +684,7 @@ void ViewerWidget::ForceRequeueFromCurrentTime()
RenderTicketWatcher *watcher = RequestNextFrameForQueue();
if (!first_requeue_watcher_) {
first_requeue_watcher_ = watcher;
connect(first_requeue_watcher_, &RenderTicketWatcher::destroyed, this, &ViewerWidget::HandleFirstRequeueDestroy);
}
}
}