[vlc-devel] [PATCH]: fix skins2 crashing within Qt Menus

erwan.tulou at gmail.com erwan.tulou at gmail.com
Sun Sep 22 23:04:57 CEST 2019


Hello,

    Please find attached a patch that fixes skins2 crashing within the 
Qt Menus in latest vlc repository.

   Details are included in the header of the patch.

Regards
Erwan



---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
-------------- next part --------------
From 56b22658c3e0b650f5ec112d38b58c98e366a2a1 Mon Sep 17 00:00:00 2001
From: Erwan Tulou <erwan10 at videolan.org>
Date: Sun, 22 Sep 2019 22:05:07 +0200
Subject: [PATCH] Qt(menu): fix improper dataChanged() signal emission

At https://doc.qt.io/qt-5/qabstractitemmodel.html#dataChanged, it reads:
"This signal is emitted whenever the data in an existing item changes."

My understanding is that emitting dataChanged() is limited to the update of
an existing item. Neither insertion nor deletion of an item have to emit
this signal.

Furthermore, in the case of deletion, this may lead to the following error:

ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h, line 549
---
 modules/gui/qt/util/input_models.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/modules/gui/qt/util/input_models.cpp b/modules/gui/qt/util/input_models.cpp
index 8c795df1ef..f344e8b7f1 100644
--- a/modules/gui/qt/util/input_models.cpp
+++ b/modules/gui/qt/util/input_models.cpp
@@ -83,8 +83,6 @@ void TrackListModel::updateTracks(vlc_player_list_action action, const vlc_playe
         beginInsertRows({}, m_data.size(), m_data.size());
         m_data.append(Data{ track_info });
         endInsertRows();
-        QModelIndex dataIndex = index(m_data.size() - 1);
-        emit dataChanged(dataIndex, dataIndex);
         break;
     }
     case VLC_PLAYER_LIST_REMOVED:
@@ -99,8 +97,6 @@ void TrackListModel::updateTracks(vlc_player_list_action action, const vlc_playe
         beginRemoveRows({}, pos, pos);
         m_data.erase(it);
         endRemoveRows();
-        QModelIndex dataIndex = index(pos);
-        emit dataChanged(dataIndex, dataIndex);
         break;
     }
     case VLC_PLAYER_LIST_UPDATED:
-- 
2.23.0



More information about the vlc-devel mailing list