@@ -226,7 +226,7 @@ void TestQgsLayoutShapes::readWriteXml()
226
226
{
227
227
QgsProject p;
228
228
QgsLayout l ( &p );
229
- QgsLayoutItemShape * shape = new QgsLayoutItemShape ( &l );
229
+ std::unique_ptr< QgsLayoutItemShape > shape = qgis::make_unique< QgsLayoutItemShape > ( &l );
230
230
shape->setShapeType ( QgsLayoutItemShape::Triangle );
231
231
QgsSimpleFillSymbolLayer *simpleFill = new QgsSimpleFillSymbolLayer ();
232
232
QgsFillSymbol *fillSymbol = new QgsFillSymbol ();
@@ -235,6 +235,7 @@ void TestQgsLayoutShapes::readWriteXml()
235
235
simpleFill->setStrokeColor ( Qt::yellow );
236
236
simpleFill->setStrokeWidth ( 6 );
237
237
shape->setSymbol ( fillSymbol );
238
+ delete fillSymbol;
238
239
239
240
// save original item to xml
240
241
QDomImplementation DomImplementation;
@@ -247,7 +248,7 @@ void TestQgsLayoutShapes::readWriteXml()
247
248
shape->writeXml ( rootNode, doc, QgsReadWriteContext () );
248
249
249
250
// create new item and restore settings from xml
250
- QgsLayoutItemShape * copy = new QgsLayoutItemShape ( &l );
251
+ std::unique_ptr< QgsLayoutItemShape > copy = qgis::make_unique< QgsLayoutItemShape > ( &l );
251
252
QVERIFY ( copy->readXml ( rootNode.firstChildElement (), doc, QgsReadWriteContext () ) );
252
253
QCOMPARE ( copy->shapeType (), QgsLayoutItemShape::Triangle );
253
254
QCOMPARE ( copy->symbol ()->symbolLayer ( 0 )->color ().name (), QStringLiteral ( " #00ff00" ) );
@@ -258,7 +259,7 @@ void TestQgsLayoutShapes::bounds()
258
259
{
259
260
QgsProject p;
260
261
QgsLayout l ( &p );
261
- QgsLayoutItemShape * shape = new QgsLayoutItemShape ( &l );
262
+ std::unique_ptr< QgsLayoutItemShape > shape = qgis::make_unique< QgsLayoutItemShape > ( &l );
262
263
shape->attemptMove ( QgsLayoutPoint ( 20 , 20 ) );
263
264
shape->attemptResize ( QgsLayoutSize ( 150 , 100 ) );
264
265
@@ -269,6 +270,7 @@ void TestQgsLayoutShapes::bounds()
269
270
simpleFill->setStrokeColor ( Qt::yellow );
270
271
simpleFill->setStrokeWidth ( 6 );
271
272
shape->setSymbol ( fillSymbol );
273
+ delete fillSymbol;
272
274
273
275
// scene bounding rect should include symbol outline
274
276
QRectF bounds = shape->sceneBoundingRect ();
0 commit comments