From d71c97f56f4eb35a8918b9741fe6bfd6417a3b5c Mon Sep 17 00:00:00 2001 From: Arno Date: Thu, 11 Apr 2013 04:37:09 +0200 Subject: Possible Bugfix for SmDirModel Check for valid QModelIndex in dirEvent. It could very well be possible that we get an invalid index from find(), especially when deleting or modifying files. Maybe this fixes some unexplained crashes I wasn't able to reproduce... --- smdirmodel.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'smdirmodel.cpp') diff --git a/smdirmodel.cpp b/smdirmodel.cpp index 6053890..1a631ba 100644 --- a/smdirmodel.cpp +++ b/smdirmodel.cpp @@ -158,6 +158,9 @@ void SmDirModel::dirEvent(const QList &data, int e){ addFile(data); } QModelIndex idx = find(data.at(Name), Name, rootIndex()); + if(!idx.isValid()){ + return; + } if(e == SmDirWatcher::Deleted){ removeRow(idx.row()); } -- cgit v1.2.3-70-g09d2