Skip to content

Commit

Permalink
fix: possible crash when a sync error early in startup (#11991)
Browse files Browse the repository at this point in the history
During startup, sync was enabled before the UI was completely set up.
This could lead to a crash when a sync error occurred, which would try
to show it in the UI.

Fixes: #11988
  • Loading branch information
erikjv authored Nov 25, 2024
1 parent b65361a commit d4e3682
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,6 @@ int main(int argc, char **argv)
return -1;
}

folderManager->setSyncEnabled(true);

auto ocApp = Application::createInstance(platform.get(), displayLanguage, options.debugMode);

QObject::connect(platform.get(), &Platform::requestAttention, ocApp->gui(), &ownCloudGui::slotShowSettings);
Expand All @@ -518,11 +516,17 @@ int main(int argc, char **argv)
platform->startServices();

#ifdef WITH_AUTO_UPDATER
if (Updater::instance()) {
// validate whether the last update was successful.
Updater::instance()->validateUpdate();
}
if (Updater::instance()) {
// validate whether the last update was successful.
Updater::instance()->validateUpdate();
}
#endif

// Enable syncing. We cannot do this earlier, because the UI needs to be set up in order to
// show sync errors. We also want to wait for the auto-updater to finish, in case it needs
// to install an update.
folderManager->setSyncEnabled(true);

if (options.show) {
ocApp->gui()->slotShowSettings();
// The user explicitly requested the settings dialog, so don't start the new-account wizard.
Expand Down

0 comments on commit d4e3682

Please sign in to comment.