From 78553af05ba97da0920f7cabd281503bd4ca484a Mon Sep 17 00:00:00 2001 From: Mladen Milinkovic Date: Wed, 23 Nov 2022 15:47:56 +0100 Subject: [PATCH] VobSub: fixed crash when moving to previous image Do not delete lines on temporary Subtitle that is shown in LinesWidget. SubtitleLine is deleted immediately, while LinesWidget wants to repaint before line reference is removed from its list model. https://bugs.kde.org/show_bug.cgi?id=462156 --- src/formats/vobsub/vobsubinputprocessdialog.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/formats/vobsub/vobsubinputprocessdialog.cpp b/src/formats/vobsub/vobsubinputprocessdialog.cpp index ac54b552..2ba61550 100644 --- a/src/formats/vobsub/vobsubinputprocessdialog.cpp +++ b/src/formats/vobsub/vobsubinputprocessdialog.cpp @@ -697,9 +697,12 @@ VobSubInputProcessDialog::processNextPiece() piecePrev = piece; } - SubtitleLine *l = new SubtitleLine((*m_frameCurrent)->subShowTime, (*m_frameCurrent)->subHideTime); + SubtitleLine *l = m_subtitle->line((*m_frameCurrent)->index); + if(!l) { + l = new SubtitleLine((*m_frameCurrent)->subShowTime, (*m_frameCurrent)->subHideTime); + m_subtitle->insertLine(l); + } l->primaryDoc()->setPlainText(subText); - m_subtitle->insertLine(l); ui->grpText->setDisabled(true); ui->grpNavButtons->setDisabled(true); @@ -809,8 +812,6 @@ VobSubInputProcessDialog::onPrevImageClicked() return; --m_frameCurrent; - if(m_subtitle->lastIndex() >= 0) - m_subtitle->removeLines(RangeList(Range(m_subtitle->lastIndex())), Both); ui->progressBar->setValue((*m_frameCurrent)->index + 1); -- GitLab