[vlmc-devel] commit: EffectInstanceListModel.cpp: Fixes potential segmentation fault, checks row count before moving up and removing rows. (Rohit Yadav )

git at videolan.org git at videolan.org
Wed Sep 22 22:49:49 CEST 2010


vlmc | branch: master | Rohit Yadav <rohityadav89 at gmail.com> | Thu Sep 23 02:37:14 2010 +0530| [c67e95ebc48caa232ee53faa69af81c96bb33d2f] | committer: Rohit Yadav 

EffectInstanceListModel.cpp: Fixes potential segmentation fault, checks row count before moving up and removing rows.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=c67e95ebc48caa232ee53faa69af81c96bb33d2f
---

 src/Gui/effectsengine/EffectInstanceListModel.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Gui/effectsengine/EffectInstanceListModel.cpp b/src/Gui/effectsengine/EffectInstanceListModel.cpp
index 8b8c597..2d0a38e 100644
--- a/src/Gui/effectsengine/EffectInstanceListModel.cpp
+++ b/src/Gui/effectsengine/EffectInstanceListModel.cpp
@@ -67,7 +67,7 @@ EffectInstanceListModel::data( const QModelIndex &index, int role ) const
 bool
 EffectInstanceListModel::removeRows( int row, int count, const QModelIndex& index /*= QModelIndex()*/ )
 {
-    if ( count != 1 )
+    if ( count != 1 || row < 0 )
         return false;
     beginRemoveRows( index, row, row );
     m_user->removeEffect( Effect::Filter, row );
@@ -78,7 +78,7 @@ EffectInstanceListModel::removeRows( int row, int count, const QModelIndex& inde
 void
 EffectInstanceListModel::moveUp( const QModelIndex &index )
 {
-    if ( index.row() == 0 || index.row() >= m_user->count( Effect::Filter ) )
+    if ( index.row() <= 0 || index.row() >= m_user->count( Effect::Filter ) )
         return ;
     emit layoutAboutToBeChanged();
     m_user->swapFilters( index.row(), index.row() - 1 );



More information about the Vlmc-devel mailing list