]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix possible crash when refreshing the view while renaming inline
authorFrank Reininghaus <frank78ac@googlemail.com>
Tue, 11 Sep 2012 17:43:53 +0000 (19:43 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Tue, 11 Sep 2012 17:43:53 +0000 (19:43 +0200)
It is not reproducible on every machine for me, but it seems that it can
happen that DolphinView's slot slotRoleEditingFinished() is invoked
after the items have already been removed from the model. In that case,
we have to return from the slot immediately to prevent a crash.

BUG: 306147
FIXED-IN: 4.9.2

src/views/dolphinview.cpp

index 08e26c5d67408db91472218549e83c78a83d18de..72ccb8372ca4d3c541981066b605ede13fdb00fe 100644 (file)
@@ -1321,6 +1321,10 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre
 
 void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
 {
+    if (index < 0 || index >= m_model->count()) {
+        return;
+    }
+
     if (role == "text") {
         const KFileItem oldItem = m_model->fileItem(index);
         const QString newName = value.toString();