From 3b5fa7daa545b5ff69d5671278ca2c69bdee8630 Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Mon, 27 Feb 2023 10:30:42 +0200 Subject: [PATCH] perf(qabstractlistmodel): Fix memory leak The qabstractlistmodel never takes ownership of c++ QObject. The owner bool variable is defined on nim qobject and is used to mark qml ownership on objects. --- src/nimqml/private/qabstractlistmodel.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nimqml/private/qabstractlistmodel.nim b/src/nimqml/private/qabstractlistmodel.nim index 5d4cf9e..db35c7d 100644 --- a/src/nimqml/private/qabstractlistmodel.nim +++ b/src/nimqml/private/qabstractlistmodel.nim @@ -31,6 +31,7 @@ proc setup*(self: QAbstractListModel) = self.vptr = dos_qabstractlistmodel_create(addr(self[]), self.metaObject.vptr, qobjectCallback, qaimCallbacks).DosQObject + self.owner = true proc delete*(self: QAbstractListModel) = ## Delete the given QAbstractItemModel