https://bugs.kde.org/show_bug.cgi?id=390748

            Bug ID: 390748
           Summary: Deleting a file freezes dolphin UI during the deletion
           Product: dolphin
           Version: 17.12.2
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: dolphin-bugs-n...@kde.org
          Reporter: meve...@gmail.com
                CC: elvis.angelac...@kde.org
  Target Milestone: ---

Step to reproduce

1. Select a 1 Go file (or any file that you take more than 1 second to delete
on your drive)
2. Hit shift-del
3. confirm.

Actual Result:

Dolphin UI hangs until the file is deleted. The confirmation window can stay
open while the UI is frozen.

Expected Result:

Dolphin UI is responsive.


I believe the bug is in fact in KIO::DeleteJob around lines :

            // Normal deletion
            // If local file, try do it directly
            if ((*it).isLocalFile() && QFile::remove((*it).toLocalFile())) {
                qDebug() << "DeleteJobPrivate::deleteNextFile isLocalFile" <<
QDateTime::currentDateTime();
                job = nullptr;
                m_processedFiles++;
                if (m_processedFiles % 300 == 1 || m_totalFilesDirs < 300) { 
// update progress info every 300 files
                    m_currentURL = *it;
                    slotReport();
                }
            } else {
                // if remote - or if unlink() failed (we'll use the job's error
handling in that case)
                // qDebug() << "calling file_delete on" << *it;
                if (isHttpProtocol(it->scheme())) {
                    job = KIO::http_delete(*it, KIO::HideProgressInfo);
                } else {
                    job = KIO::file_delete(*it, KIO::HideProgressInfo);
                    job->setParentJob(q);
                }
                Scheduler::setJobPriority(job, 1);
                m_currentURL = (*it);
            }


It makes deletion synchronous by default for any local file.
Any slow device or big files will cause the UI to freeze.

A workaround I have tested with success is removing the localFile fast-path:
            // Normal deletion
            // If local file, try do it directly
            if ((*it).isLocalFile() && QFile::remove((*it).toLocalFile())) {
                qDebug() << "DeleteJobPrivate::deleteNextFile isLocalFile" <<
QDateTime::currentDateTime();
                job = nullptr;
                m_processedFiles++;
                if (m_processedFiles % 300 == 1 || m_totalFilesDirs < 300) { 
// update progress info every 300 files
                    m_currentURL = *it;
                    slotReport();
                }
            } else {

It could be nice to mark the files in the UI as gray or give a some feedback
that the file is being deleted.




Could be related to:
https://bugs.kde.org/show_bug.cgi?id=389807
https://bugs.kde.org/show_bug.cgi?id=382779
https://bugs.kde.org/show_bug.cgi?id=380250

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to