summaryrefslogtreecommitdiff
path: root/media-video/subtitlecomposer/files/subtitlecomposer-0.7.1-vobsub-crashfix.patch
blob: 20c5835ba9715dde3b284b6442b164882f21aca5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 78553af05ba97da0920f7cabd281503bd4ca484a Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
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