Skip to content

Commit cda271f

Browse files
committedDec 12, 2017
Fix leak in unit test
1 parent c17d85f commit cda271f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed
 

‎tests/src/core/testqgsexpressioncontext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,11 @@ void TestQgsExpressionContext::globalScope()
588588

589589
//test removeGlobalVariables
590590
QgsExpressionContextUtils::setGlobalVariable( QStringLiteral( "key" ), "value" );
591-
QgsExpressionContextScope *globalScope3 = QgsExpressionContextUtils::globalScope();
591+
std::unique_ptr< QgsExpressionContextScope > globalScope3( QgsExpressionContextUtils::globalScope() );
592592
QVERIFY( globalScope3->hasVariable( "key" ) );
593593
QgsExpressionContextUtils::removeGlobalVariable( QStringLiteral( "key" ) );
594-
globalScope3 = QgsExpressionContextUtils::globalScope();
594+
globalScope3.reset( QgsExpressionContextUtils::globalScope() );
595595
QVERIFY( !globalScope3->hasVariable( "key" ) );
596-
delete globalScope3;
597596
}
598597

599598
void TestQgsExpressionContext::projectScope()

0 commit comments

Comments
 (0)
Please sign in to comment.