From 9893ab575d18122a029447714e3526b1125014a2 Mon Sep 17 00:00:00 2001 From: Zhang Sheng Date: Wed, 25 Sep 2024 15:34:25 +0800 Subject: [PATCH] refactor: add timeout for filejob thread When manipulating a file, if the TaskDialog has not been popped up yet, immediately close dde-file-manage at this time, here will cause the dde-file-manager process to be blocked in the main thread, and then can not open the new dde-file-manage process, so here to add a timeout time Log: add timeout for filejob thread --- .../fileoperations/fileoperationutils/abstractjob.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/abstractjob.cpp b/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/abstractjob.cpp index 960d7a255b..e1883966fa 100644 --- a/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/abstractjob.cpp +++ b/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/abstractjob.cpp @@ -56,7 +56,15 @@ AbstractJob::AbstractJob(AbstractWorker *doWorker, QObject *parent) connect(doWorker, &AbstractWorker::fileRenamed, this, &AbstractJob::handleFileRenamed, Qt::QueuedConnection); connect(qApp, &QCoreApplication::aboutToQuit, this, [=]() { thread.quit(); - thread.wait(); + // When manipulating a file, + // if the TaskDialog has not been popped up yet, + // immediately close dde-file-manage at this time, + // here will cause the dde-file-manager process + // to be blocked in the main thread, + // and then can not open the new dde-file-manage process, + // so here to add a timeout time. + // see: bug-272373 + thread.wait(3000); }); start(); }