Fix memory leak when deleting models

Change-Id: I4e040e8eb78ba13363bcf7eb74a48aaa6a0a01fd
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>