From 9e933de7f2f83946cc3926e4ea5ae0d8e4ce93bb Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Tue, 7 Mar 2017 21:52:58 +0100 Subject: [PATCH] Example: fix memory leak in relationnaltablemodel example The example creates a view on the heap but doesn't delete it on application end. This patch uses a QScopedPointer to fix that. Change-Id: I3b0c8589999d243c193bd02e1470c03eabfabe40 Reviewed-by: Sze Howe Koh --- examples/sql/relationaltablemodel/relationaltablemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.cpp b/examples/sql/relationaltablemodel/relationaltablemodel.cpp index c8faece1dd..5292256cd9 100644 --- a/examples/sql/relationaltablemodel/relationaltablemodel.cpp +++ b/examples/sql/relationaltablemodel/relationaltablemodel.cpp @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) initializeModel(&model); - QTableView *view = createView(QObject::tr("Relational Table Model"), &model); + QScopedPointer view(createView(QObject::tr("Relational Table Model"), &model)); view->show(); return app.exec();