diff options
author | Arno <arno@disconnect.de> | 2015-08-13 13:51:13 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2015-08-13 13:51:13 +0200 |
commit | e223bc238ea3e2dbeaabcc4c9218558d26273de5 (patch) | |
tree | 6597a2126b007f3dcbec993072f5984fbe7198b0 /filesystemwidget.cpp | |
parent | dc2927587eb758754babf98adb764c3bbdccd024 (diff) | |
download | SheMov-e223bc238ea3e2dbeaabcc4c9218558d26273de5.tar.gz SheMov-e223bc238ea3e2dbeaabcc4c9218558d26273de5.tar.bz2 SheMov-e223bc238ea3e2dbeaabcc4c9218558d26273de5.zip |
Fix crash in deleteFiles
This was a hard one. SmDirWatcher raced against the model. Stop and quit
the watcher before actually deleting files. That can take a while if
file operations are in progress, so show the busy cursor.
Diffstat (limited to 'filesystemwidget.cpp')
-rw-r--r-- | filesystemwidget.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 619944a..0e6e591 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -260,7 +260,11 @@ void FilesystemWidget::goBack(){ } void FilesystemWidget::deleteFiles(){ + qApp->setOverrideCursor(Qt::WaitCursor); TimerHandler h(mFileModel->refreshTimer()); + WatcherHandler wh(mFileModel->watcher()); + qApp->processEvents(); + qApp->restoreOverrideCursor(); QModelIndexList selected = mFileView->selectionModel()->selectedRows(); if(selected.isEmpty()){ return; @@ -270,8 +274,11 @@ void FilesystemWidget::deleteFiles(){ int retval = QMessageBox::question(this, tr("Question"), message, QMessageBox::Yes | QMessageBox::No); if(retval == QMessageBox::Yes){ foreach(QModelIndex idx, selected){ - QFileInfo fi(idx.data(SmDirModel::FullPathRole).toString()); - deleteRecursive(fi); + QModelIndex real = mFileProxy->mapToSource(idx); + if(real.isValid()){ + QFileInfo fi(real.data(SmDirModel::FullPathRole).toString()); + deleteRecursive(fi); + } } } } |