Skip to content
Permalink
Browse files

Merge pull request #38488 from dmarteau/fix-server-set-instance

Server: Call QgsProject::setInstance on project passed as parameter
  • Loading branch information
rldhont committed Aug 31, 2020
2 parents afc099f + fb3a178 commit 93819344d63acae260476dda1de47bcb18e7dcc9
Showing with 4 additions and 2 deletions.
  1. +1 −1 src/core/qgsproject.h
  2. +0 −1 src/server/qgsconfigcache.cpp
  3. +3 −0 src/server/qgsserver.cpp
@@ -1985,7 +1985,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;
};
@@ -112,7 +112,6 @@ const QgsProject *QgsConfigCache::project( const QString &path, QgsServerSetting
QStringLiteral( "Server" ), Qgis::Critical );
}
}
QgsProject::setInstance( mProjectCache[ path ] );
return mProjectCache[ path ];

}
@@ -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() );

0 comments on commit 9381934

Please sign in to comment.
You can’t perform that action at this time.