Skip to content

Commit 50181ee

Browse files
committed
Clean up QgsExpressionContext in QgsServer::handleRequest
1 parent 882cd7b commit 50181ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/server/qgsserver.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,13 @@ QPair<QByteArray, QByteArray> QgsServer::handleRequest( const QString& queryStri
465465
int logLevel = QgsServerLogger::instance()->logLevel();
466466
QTime time; //used for measuring request time if loglevel < 1
467467
QgsMapLayerRegistry::instance()->removeAllMapLayers();
468+
469+
// Clean up Expression Context
470+
// because each call to QgsMapLayer::draw add items to QgsExpressionContext scope
471+
// list. This prevent the scope list to grow indefinitely and seriously deteriorate
472+
// performances and memory in the long run
473+
sMapRenderer->rendererContext()->setExpressionContext( QgsExpressionContext() );
474+
468475
sQgsApplication->processEvents();
469476
if ( logLevel < 1 )
470477
{

0 commit comments

Comments
 (0)