qof_instance_dispose should always complete dispose processes

If QofInstancePrivate has no collection then qof_instance_dispose() returns
without completing the rest of its dispose processes, skipping removal of
its type string from the string cache resulting in a reference count leak.

Change the check for a collection so that it only affects the call to
qof_collection_remove_entity().
This commit is contained in:
Simon Arlott 2021-07-11 15:09:45 +01:00
parent 0061e21c4f
commit 7a0ea190ca
No known key found for this signature in database
GPG Key ID: DF001BFD83E75990

View File

@ -319,9 +319,8 @@ qof_instance_dispose (GObject *instp)
QofInstance* inst = QOF_INSTANCE(instp);
priv = GET_PRIVATE(instp);
if (!priv->collection)
return;
qof_collection_remove_entity(inst);
if (priv->collection)
qof_collection_remove_entity(inst);
CACHE_REMOVE(inst->e_type);
inst->e_type = NULL;