Question about QofIdType assertion in QofCollection

Chenxiong Qi qcxhome at gmail.com
Mon Dec 29 10:32:24 EST 2014


On Mon, Dec 29, 2014 at 8:22 PM, Derek Atkins <derek at ihtfp.com> wrote:
> Because it's a constant.
>

Thanks!

In following scenario, a QofInstance cannot be added into a QofCollection

QofIdType type = "some type";
QofInstance inst = g_object_new (QOF_TYPE_INSTANCE, NULL);
inst->e_type = type;
QofCollection coll = qof_collection_new (type);
qof_collection_add_entity (coll, inst);

The last call will always fail, because coll's e_type has different
address with the original variable type due to invocation of
static_cast<QofIdType>

> -derek
>
> Sent on my mobile. Please forgive any typos.
>
> ----- Reply message -----
> From: "Chenxiong Qi" <qcxhome at gmail.com>
> To: "gnucash-devel at gnucash.org" <gnucash-devel at gnucash.org>
> Subject: Question about QofIdType assertion in QofCollection
> Date: Mon, Dec 29, 2014 3:35 AM
>
> Hi all,
>
> In qof_collection_add_entity and qof_collection_insert_entity, it expects,
>
> g_return_if_fail (col->e_type == ent->e_type);
>
> Is this the actual expectation by checking the equivalence of pointer
> locations, why not the values?
>
> --
> Regards,
> Chenxiong Qi
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel



-- 
Regards,
Chenxiong Qi


More information about the gnucash-devel mailing list