QSF Import of gncCustomer and gncAddress Issues (and partial success)

Georgi Mirchev manager at mirchevideas.com
Tue May 30 16:11:05 EDT 2006



Derek Atkins wrote:

> Please CC gnucash-devel on all replies!!!

Sorry.

>
> Quoting Georgi Mirchev <manager at mirchevideas.com>:
>
>> Well, if the QSF doesn't "set" an address, then it should set the 
>> address properties instead. But that would mean adding a lot of 
>> additional params together with their setters/getters to gncCustomer, 
>> gncVendor and gncEmployee.
>
>
> Not necessarily.
>
>> To me "setting" address seems right. Why do you think this "setting" 
>> isn't right?
>
>
> Why does the "set address" API have to replace the "address" object in 
> the
> customer/vendor/employee?  Why not have the qof setter copy the address
> values into the actual object?
>
> E.g.:
>
>  qofFooSetXAddress(QofInstance* inst, GncAddress* addr)
>  {
>     ...
>     gncAddressSet(object->addr, addr);
>     qof_instance_destroy(addr);
>     ...
>   }
>
>  gncAddressSet(GncAddress* dest, const GncAddress* src)
>  {
>      // copy src values to dest
>      CACHE_REPLACE(dest->name, src->name);
>      ...
>   }
>
Well, there is no qof_instance_destroy(), only qof_instance_release(), 
which doesn't deregister from the book. It doesn't actually matter which 
object is destroyed, since both are in the book, and if any of them is 
destroyed without deregistering segfault will follow. To me it doesn't 
make sense to call a setAddress function and get the object you pass as 
parameter destroyed.

My suggestion is to have the current gncAddressDestroy() to call 
qof_instance_release(), and modify qof_instance_release() to actually 
remove the object from the book. This should solve all problems, unless 
you spot a something smelly here :-)


>> Since a gncAddress can only live in one book, it seems right for it 
>> to deregister itself from the book in it's destructor.
>
>
> I didn't disagree with that.  The QOFization of gncAddress clearly wasn't
> fully pondered before it was half-implemented.  Unfortunately you got
> caught in the quagmire.
>
> -derek
>

-- 
*Mirchev Ideas Ltd.*
1111 Sofia, Bulgaria
Golash 18

( + 359 2 ) 870 55 66
manager at mirchevideas.com <mailto:manager at mirchevideas.com>

ICQ: 77517413
Yahoo: mirchevideas
MSN: manager at mirchevideas.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: manager.vcf
Type: text/x-vcard
Size: 550 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20060530/641b8a96/manager.vcf


More information about the gnucash-devel mailing list