继续修改部分fileInfoJob的setAutoDelete流程为手动删除

This commit is contained in:
Yue-Lan 2023-09-15 10:34:19 +08:00
parent eeb22651e6
commit a9aa1361a0
5 changed files with 11 additions and 6 deletions

View File

@ -308,7 +308,7 @@ void LocationBar::updateButtons()
for (auto info : m_buttons_info) {
auto infoJob = new FileInfoJob(info);
infoJob->setAutoDelete();
//infoJob->setAutoDelete();
connect(infoJob, &FileInfoJob::queryAsyncFinished, this, [=](){
// enumerate buttons info directory
auto enumerator = new FileEnumerator;
@ -343,6 +343,7 @@ void LocationBar::updateButtons()
});
enumerator->enumerateAsync();
infoJob->deleteLater();
});
infoJob->queryAsync();
}

View File

@ -428,10 +428,11 @@ void FileEnumerator::enumerateAsync()
// query directory info first
auto infoJob = new FileInfoJob(m_uri);
infoJob->setAutoDelete(true);
//infoJob->setAutoDelete(true);
connect(infoJob, &FileInfoJob::queryAsyncFinished, this, [=](bool successed){
if (!successed) {
Q_EMIT enumerateFinished(false);
infoJob->deleteLater();
return;
}
//auto uri = g_file_get_uri(m_root_file);
@ -444,7 +445,7 @@ void FileEnumerator::enumerateAsync()
m_cancellable,
GAsyncReadyCallback(find_children_async_ready_callback),
this);
infoJob->deleteLater();
});
connect(this, &FileEnumerator::cancelled, infoJob, &FileInfoJob::cancel);
infoJob->queryAsync();

View File

@ -88,13 +88,14 @@ void PathBarModel::setRootUri(const QString &uri, bool force)
m_info = FileInfo::fromUri(uri);
auto infoJob = new FileInfoJob(m_info);
infoJob->setAutoDelete();
//infoJob->setAutoDelete();
connect(infoJob, &FileInfoJob::queryAsyncFinished, this, [=](bool successed){
if (successed) {
m_enumerator->cancel();
m_enumerator->setEnumerateDirectory(m_info.get()->uri());
m_enumerator->enumerateAsync();
}
infoJob->deleteLater();
});
infoJob->queryAsync();

View File

@ -107,10 +107,11 @@ void NavigationTabBar::updateLocation(int index, const QString &uri)
{
auto info = Peony::FileInfo::fromUri(uri);
auto infoJob = new Peony::FileInfoJob(info);
infoJob->setAutoDelete();
//infoJob->setAutoDelete();
setTabData(index, uri);
connect(infoJob, &Peony::FileInfoJob::queryAsyncFinished, this, [=](){
infoJob->deleteLater();
if (uri != tabData(index).toString())
return;
auto iconName = Peony::FileUtils::getFileIconName(uri);

View File

@ -1227,9 +1227,10 @@ void TabWidget::addPage(const QString &uri, bool jumpTo)
auto info = Peony::FileInfo::fromUri(uri);
auto infoJob = new Peony::FileInfoJob(info);
infoJob->setAutoDelete();
//infoJob->setAutoDelete();
connect(infoJob, &Peony::FileInfoJob::queryAsyncFinished, this, [=](){
infoJob->deleteLater();
QString rootDir = info.get()->uri();
if (info.get()->uri().startsWith("file:///") && !info.get()->isDir()) {
rootDir = Peony::FileUtils::getParentUri(rootDir);