From 8fe726a84d17d47c22021cd47936842c4916e635 Mon Sep 17 00:00:00 2001 From: Matej Bagar Date: Mon, 15 Dec 2025 22:45:53 +0100 Subject: [PATCH 1/2] Fix automatic sync on cold start to open project --- app/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/main.cpp b/app/main.cpp index 0cd2bb354..af05dac21 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -556,6 +556,16 @@ int main( int argc, char *argv[] ) // it secures lambdas, so that they are destroyed when this object is destroyed to avoid crashes. QObject lambdaContext; + // the automatic sync request on cold start will fail on MerginApiStatus not being initialized yet, so we call it again + // after server ping is done + if ( activeProject.autosyncController() ) + { + QObject::connect(ma.get(), &MerginApi::pingMerginFinished, &lambdaContext, [&activeProject] + { + activeProject.requestSync(SyncOptions::AutomaticRequest); + }, Qt::SingleShotConnection); + } + QObject::connect( &app, &QGuiApplication::applicationStateChanged, &lambdaContext, []( Qt::ApplicationState state ) { QString msg; From b84611b5395fb508eed3adf83e8a12649021eef1 Mon Sep 17 00:00:00 2001 From: Matej Bagar Date: Mon, 15 Dec 2025 22:48:10 +0100 Subject: [PATCH 2/2] Fix formatting --- app/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/main.cpp b/app/main.cpp index af05dac21..e5bda4ca6 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -560,10 +560,10 @@ int main( int argc, char *argv[] ) // after server ping is done if ( activeProject.autosyncController() ) { - QObject::connect(ma.get(), &MerginApi::pingMerginFinished, &lambdaContext, [&activeProject] + QObject::connect( ma.get(), &MerginApi::pingMerginFinished, &lambdaContext, [&activeProject] { - activeProject.requestSync(SyncOptions::AutomaticRequest); - }, Qt::SingleShotConnection); + activeProject.requestSync( SyncOptions::AutomaticRequest ); + }, Qt::SingleShotConnection ); } QObject::connect( &app, &QGuiApplication::applicationStateChanged, &lambdaContext, []( Qt::ApplicationState state )