Skip to content

Commit

Permalink
Clean up QgsExpressionContext in QgsServer::handleRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarteau committed Jun 7, 2016
1 parent 882cd7b commit 50181ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/server/qgsserver.cpp
Expand Up @@ -465,6 +465,13 @@ QPair<QByteArray, QByteArray> QgsServer::handleRequest( const QString& queryStri
int logLevel = QgsServerLogger::instance()->logLevel();
QTime time; //used for measuring request time if loglevel < 1
QgsMapLayerRegistry::instance()->removeAllMapLayers();

// Clean up Expression Context
// because each call to QgsMapLayer::draw add items to QgsExpressionContext scope
// list. This prevent the scope list to grow indefinitely and seriously deteriorate
// performances and memory in the long run
sMapRenderer->rendererContext()->setExpressionContext( QgsExpressionContext() );

sQgsApplication->processEvents();
if ( logLevel < 1 )
{
Expand Down

0 comments on commit 50181ee

Please sign in to comment.