[gnc-tree-model-owner.c] owner_list must be freed

This commit is contained in:
Christopher Lam 2021-07-12 20:08:40 +08:00
parent 9767c86337
commit 7ffe0a5391

View File

@ -192,6 +192,9 @@ gnc_tree_model_owner_finalize (GObject *object)
model = GNC_TREE_MODEL_OWNER (object);
priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
if (priv->owner_list)
g_list_free_full (priv->owner_list, (GDestroyNotify) gncOwnerFree);
priv->book = NULL;
priv->owner_list = NULL;
@ -976,6 +979,9 @@ gnc_tree_model_owner_event_handler (QofInstance *entity,
/* Tell the filters/views where the new owner was added. */
DEBUG("add owner %p (%s)", &owner, gncOwnerGetName(&owner));
/* First update our copy of the owner list. This isn't done automatically */
if (priv->owner_list)
g_list_free_full (priv->owner_list, (GDestroyNotify) gncOwnerFree);
priv->owner_list = gncBusinessGetOwnerList (priv->book,
gncOwnerTypeToQofIdType(priv->owner_type), TRUE);
increment_stamp(model);