Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #38509 from qgis-bot/backport-38488-to-release-3_14
[Backport release-3_14] Server: Call QgsProject::setInstance on project passed as parameter
  • Loading branch information
rldhont committed Sep 2, 2020
2 parents 94a208f + 362af28 commit e60e65c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsproject.h
Expand Up @@ -1976,7 +1976,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
friend class QgsProviderRegistry;

// Required by QGIS Server for switching the current project instance
friend class QgsConfigCache;
friend class QgsServer;

friend class TestQgsProject;
};
Expand Down
1 change: 0 additions & 1 deletion src/server/qgsconfigcache.cpp
Expand Up @@ -95,7 +95,6 @@ const QgsProject *QgsConfigCache::project( const QString &path, QgsServerSetting
QStringLiteral( "Server" ), Qgis::Critical );
}
}
QgsProject::setInstance( mProjectCache[ path ] );
return mProjectCache[ path ];

}
Expand Down
3 changes: 3 additions & 0 deletions src/server/qgsserver.cpp
Expand Up @@ -373,6 +373,9 @@ void QgsServer::handleRequest( QgsServerRequest &request, QgsServerResponse &res
project = mConfigCache->project( configFilePath, sServerInterface->serverSettings() );
}

// Set the current project instance
QgsProject::setInstance( const_cast<QgsProject *>( project ) );

if ( project )
{
sServerInterface->setConfigFilePath( project->fileName() );
Expand Down

0 comments on commit e60e65c

Please sign in to comment.