Skip to content

Commit

Permalink
Clear project in readProjectFile to avoid threading issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 16, 2024
1 parent dad4163 commit f2829bc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/core/qgismobileapp.cpp
Expand Up @@ -687,8 +687,6 @@ bool QgisMobileapp::loadProjectFile( const QString &path, const QString &name )

mAuthRequestHandler->clearStoredRealms();

// Clear project to empty the layer tree prior to freezing during project load
mProject->clear();
mProjectFilePath = path;
mProjectFileName = !name.isEmpty() ? name : fi.completeBaseName();

Expand All @@ -704,9 +702,6 @@ void QgisMobileapp::reloadProjectFile()
if ( mProjectFilePath.isEmpty() )
QgsMessageLog::logMessage( tr( "No project file currently opened" ), QStringLiteral( "QField" ), Qgis::Warning );

// Clear project to empty the layer tree prior to freezing during project load
mProject->clear();

emit loadProjectTriggered( mProjectFilePath, mProjectFileName );
}

Expand All @@ -720,6 +715,7 @@ void QgisMobileapp::readProjectFile()

const QString suffix = fi.suffix().toLower();

mProject->clear();
mProject->layerTreeRegistryBridge()->setLayerInsertionMethod( Qgis::LayerTreeInsertionMethod::OptimalInInsertionGroup );

mTrackingModel->reset();
Expand Down

1 comment on commit f2829bc

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please sign in to comment.