Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package subtitlecomposer for 
openSUSE:Factory checked in at 2021-11-05 22:58:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/subtitlecomposer (Old)
 and      /work/SRC/openSUSE:Factory/.subtitlecomposer.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "subtitlecomposer"

Fri Nov  5 22:58:37 2021 rev:10 rq:929552 version:0.7.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/subtitlecomposer/subtitlecomposer.changes        
2021-10-16 22:48:15.192722911 +0200
+++ 
/work/SRC/openSUSE:Factory/.subtitlecomposer.new.1890/subtitlecomposer.changes  
    2021-11-05 22:58:52.476291121 +0100
@@ -1,0 +2,6 @@
+Thu Nov  4 10:48:42 UTC 2021 - Luigi Baldoni <[email protected]>
+
+- Add subtitlecomposer-fix_empty_lines_crash.patch
+  (fixes boo#1192342)
+
+-------------------------------------------------------------------

New:
----
  subtitlecomposer-fix_empty_lines_crash.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ subtitlecomposer.spec ++++++
--- /var/tmp/diff_new_pack.1YPBk4/_old  2021-11-05 22:58:52.952291415 +0100
+++ /var/tmp/diff_new_pack.1YPBk4/_new  2021-11-05 22:58:52.956291417 +0100
@@ -28,6 +28,8 @@
 Source2:        subtitlecomposer.keyring
 # PATCH-FIX-UPSTREAM subtitlecomposer-ARM_GLES.patch
 Patch0:         subtitlecomposer-ARM_GLES.patch
+# PATCH-FIX-UPSTREAM subtitlecomposer-fix_empty_lines_crash.patch
+Patch1:         subtitlecomposer-fix_empty_lines_crash.patch
 BuildRequires:  cmake >= 3.10
 BuildRequires:  extra-cmake-modules
 BuildRequires:  libQt5Widgets-private-headers-devel


++++++ subtitlecomposer-fix_empty_lines_crash.patch ++++++
>From 17811ce518f2db3db4ecb15c81ed774593715713 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <[email protected]>
Date: Thu, 14 Oct 2021 02:32:16 +0200
Subject: [PATCH] Fix crashes on empty lines list

---
 src/gui/treeview/linesmodel.cpp          | 15 ++++++++++++---
 src/gui/treeview/linesselectionmodel.cpp | 17 +++++++++++++----
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/gui/treeview/linesmodel.cpp b/src/gui/treeview/linesmodel.cpp
index e36c2dd..afcd1db 100644
--- a/src/gui/treeview/linesmodel.cpp
+++ b/src/gui/treeview/linesmodel.cpp
@@ -314,12 +314,14 @@ LinesModel::onLinesRemoved(int firstIndex, int lastIndex)
 void
 LinesModel::onModelReset()
 {
-       beginResetModel();
-       endResetModel();
-
        LinesWidget *w = static_cast<LinesWidget *>(parent());
        QItemSelectionModel *sm = w->selectionModel();
 
+       const QModelIndex prevIndex = sm->currentIndex();;
+
+       beginResetModel();
+       endResetModel();
+
        if(sm->hasSelection()) {
                if(!sm->currentIndex().isValid()) {
                        const QModelIndex idx = 
index(sm->selection().first().top());
@@ -332,6 +334,13 @@ LinesModel::onModelReset()
                        sm->select(QItemSelection(first, last), 
QItemSelectionModel::ClearAndSelect);
                }
                sm->setCurrentIndex(first, QItemSelectionModel::Rows);
+       } else {
+               if(prevIndex.isValid() && !sm->currentIndex().isValid()) {
+                       // model reset should invalidate current index and 
prevent signals
+                       QSignalBlocker s(sm); // make sure nothing fires anyway
+                       sm->setCurrentIndex(prevIndex, 
QItemSelectionModel::Rows);
+               }
+               sm->clear();
        }
 
        if(w->scrollFollowsModel())
diff --git a/src/gui/treeview/linesselectionmodel.cpp 
b/src/gui/treeview/linesselectionmodel.cpp
index 2dc14d5..9a1ccd2 100644
--- a/src/gui/treeview/linesselectionmodel.cpp
+++ b/src/gui/treeview/linesselectionmodel.cpp
@@ -28,7 +28,8 @@ LinesSelectionModel::LinesSelectionModel(LinesModel *model)
 void
 LinesSelectionModel::setCurrentIndex(const QModelIndex &index, 
QItemSelectionModel::SelectionFlags command)
 {
-       m_currentLine = static_cast<LinesModel 
*>(model())->subtitle()->line(index.row());
+       Subtitle *sub = static_cast<LinesModel *>(model())->subtitle();
+       m_currentLine = sub ? sub->line(index.row()) : nullptr;
        QItemSelectionModel::setCurrentIndex(index, command);
 }
 
@@ -50,6 +51,9 @@ LinesSelectionModel::select(const QItemSelection &selection, 
QItemSelectionModel
                m_selection.clear();
 
        const Subtitle *subtitle = static_cast<LinesModel 
*>(model())->subtitle();
+       if(!subtitle)
+               return;
+
        QModelIndexList sel = selection.indexes();
        while(!sel.empty()) {
                const SubtitleLine *line = 
subtitle->line(sel.takeFirst().row());
@@ -83,11 +87,16 @@ LinesSelectionModel::reset()
        QItemSelectionModel::reset();
        m_resetInProgress = false;
 
-       if(m_currentLine)
-               
QItemSelectionModel::setCurrentIndex(model()->index(m_currentLine->index(), 0), 
QItemSelectionModel::Current);
-
        const LinesModel *model = static_cast<LinesModel *>(this->model());
        Subtitle *subtitle = model->subtitle();
+       if(!subtitle) {
+               QItemSelectionModel::clear();
+               return;
+       }
+
+       if(m_currentLine)
+               
QItemSelectionModel::setCurrentIndex(model->index(m_currentLine->index(), 0), 
QItemSelectionModel::Current);
+
        const int lastCol = model->columnCount() - 1;
        for(auto it = m_selection.cbegin(); it != m_selection.cend(); ++it) {
                const SubtitleLine *line = *it;
-- 
GitLab

Reply via email to