Entity artefacts?

Derek Atkins warlord at MIT.EDU
Sat Mar 19 11:50:43 EST 2005


First guess:  the Account Tree is creating a top-level Account to "hold" the
top-level AccountGroup, so when you iterate you're seeing this "temporary"
account in the list.

-derek

Quoting Neil Williams <linux at codehelp.co.uk>:

> 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>
>     </object>
> 
> 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
> =============
> http://www.dcglug.org.uk/
> http://www.nosoftwarepatents.com/
> http://sourceforge.net/projects/isbnsearch/
> http://www.neil.williamsleesmill.me.uk/
> http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3
> 
> 


-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list