diff --git a/changelog/unreleased/9600 b/changelog/unreleased/9600 new file mode 100644 index 00000000000..21d8fca2b2a --- /dev/null +++ b/changelog/unreleased/9600 @@ -0,0 +1,5 @@ +Bugfix: Crash when interacting with a folder in an error state + +We fixed a crash wher using the context menu on a folder that encountered an error and was not using virutal files. + +https://github.com/owncloud/client/issues/9600 diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index e71597016e0..7ad064794cf 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -599,6 +599,7 @@ int Folder::slotWipeErrorBlacklist() void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason) { + Q_ASSERT(isReady()); if (!FileSystem::isChildPathOf(path, this->path())) { qCDebug(lcFolder) << "Changed path is not contained in folder, ignoring:" << path; return; @@ -809,19 +810,23 @@ void Folder::removeFromSettings() const bool Folder::isFileExcludedAbsolute(const QString &fullPath) const { + if (!_engine) { + return true; + } return _engine->excludedFiles().isExcluded(fullPath, path(), _definition.ignoreHiddenFiles); } bool Folder::isFileExcludedRelative(const QString &relativePath) const { - return _engine->excludedFiles().isExcluded(path() + relativePath, path(), _definition.ignoreHiddenFiles); + return isFileExcludedAbsolute(path() + relativePath); } void Folder::slotTerminateSync() { + Q_ASSERT(isReady()); qCInfo(lcFolder) << "folder " << alias() << " Terminating!"; - if (_engine->isSyncRunning()) { + if (OC_ENSURE(_engine) && _engine->isSyncRunning()) { _engine->abort(); setSyncState(SyncResult::SyncAbortRequested); @@ -875,6 +880,9 @@ void Folder::wipeForRemoval() bool Folder::reloadExcludes() { + if (!_engine) { + return true; + } return _engine->excludedFiles().reloadExcludeFiles(); } @@ -941,6 +949,7 @@ void Folder::startSync() void Folder::setSyncOptions() { + Q_ASSERT(isReady()); SyncOptions opt; ConfigFile cfgFile; @@ -964,6 +973,7 @@ void Folder::setSyncOptions() void Folder::setDirtyNetworkLimits() { + Q_ASSERT(isReady()); ConfigFile cfg; int downloadLimit = -75; // 75% int useDownLimit = cfg.useDownloadLimit(); @@ -999,6 +1009,7 @@ void Folder::slotSyncStarted() void Folder::slotSyncFinished(bool success) { + Q_ASSERT(isReady()); qCInfo(lcFolder) << "Client version" << Theme::instance()->aboutVersions(Theme::VersionFormat::OneLiner); bool syncError = !_syncResult.errorStrings().isEmpty(); diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 6f2f40fe5c4..6c3f3f15f70 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -553,6 +553,9 @@ bool FolderStatusModel::canFetchMore(const QModelIndex &parent) const void FolderStatusModel::fetchMore(const QModelIndex &parent) { + if (!data(parent, FolderStatusDelegate::IsReady).toBool()) { + return; + } auto info = infoForIndex(parent); if (!info || info->_fetched || info->_fetchingJob)