Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
Fixes: #9600
  • Loading branch information
TheOneRing committed Apr 25, 2022
1 parent aa1de47 commit 494abfb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/9600
Original file line number Diff line number Diff line change
@@ -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
15 changes: 13 additions & 2 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -875,6 +880,9 @@ void Folder::wipeForRemoval()

bool Folder::reloadExcludes()
{
if (!_engine) {
return true;
}
return _engine->excludedFiles().reloadExcludeFiles();
}

Expand Down Expand Up @@ -941,6 +949,7 @@ void Folder::startSync()

void Folder::setSyncOptions()
{
Q_ASSERT(isReady());
SyncOptions opt;
ConfigFile cfgFile;

Expand All @@ -964,6 +973,7 @@ void Folder::setSyncOptions()

void Folder::setDirtyNetworkLimits()
{
Q_ASSERT(isReady());
ConfigFile cfg;
int downloadLimit = -75; // 75%
int useDownLimit = cfg.useDownloadLimit();
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/gui/folderstatusmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

1 comment on commit 494abfb

@jnweiger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard to reproduce. Code appears to be improved.

Please sign in to comment.