Entity artefacts?

Neil Williams linux at codehelp.co.uk
Sat Mar 19 05:48:17 EST 2005

I'm coming across v.odd errors in some QofBook's created in G2.

    <object type="Account" count="5">
      <string type="desc"/>
      <string type="code"/>
      <string type="notes"/>
      <string type="name"/>
      <guid type="guid">8ce6c6798adfde73b480a889250ed3d9</guid>
      <boolean type="tax-related-p">false</boolean>
      <boolean type="non-standard-scu">false</boolean>
      <gint32 type="smallest-commodity-unit">100</gint32>
      <gint32 type="account-type">4294967295</gint32>

Obviously account-type is invalid and I can check for this, but why (and how) 
is this entity being created in a normal GnuCash book? 

(the enum as string is a separate solution and this will take care of errors 
like this by converting to a string. In this case, it would return NULL, with 
valid accounts it would return const char* "Bank" etc. and the parameter 
would then be <string type="account-type">Bank</string>.)

When I create books of non-GnuCash objects, I never get artefacts like this. 
GnuCash itself will ignore these - probably because there's no link to an 
AccountGroup that I can find. When I iterate over all objects in the book, 
the artefact shows up.

This false account causes a problematic segmentation fault too.

Try to read (QofEntity*)ent->e_type for the entity that corresponds to this 
account in the book and it is non-NULL but seg faults.

g_return_if_fail(ent->e_type != NULL); is no protection, so I find it 
difficult to check and avoid the error and seg faults aren't acceptable!!

I've tried with old books, new books, I always get errors like this. It's not 
just accounts either, I'm getting exactly the same error with GncInvoice - 
print ent->e_type in gdb gives "Cannot access memory at position ..."

yet print ent == NULL prints 0 - FALSE.
and print ent prints (QofEntity*)

Any ideas what's going on?


Neil Williams

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20050319/7bf7b644/attachment.bin

More information about the gnucash-devel mailing list