Add a few gncAddressBeginEdit before gncAddressDestroy.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15874 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2007-04-11 15:37:09 +00:00
parent 584819956f
commit 4acc6ac577
4 changed files with 21 additions and 4 deletions

View File

@ -195,7 +195,9 @@ static void gncCustomerFree (GncCustomer *cust)
CACHE_REMOVE (cust->id);
CACHE_REMOVE (cust->name);
CACHE_REMOVE (cust->notes);
gncAddressBeginEdit (cust->addr);
gncAddressDestroy (cust->addr);
gncAddressBeginEdit (cust->shipaddr);
gncAddressDestroy (cust->shipaddr);
g_list_free (cust->jobs);
@ -442,7 +444,10 @@ qofCustomerSetAddr (GncCustomer *cust, QofInstance *addr_ent)
if(!cust || !addr_ent) { return; }
addr = (GncAddress*)addr_ent;
if(addr == cust->addr) { return; }
if(cust->addr != NULL) { gncAddressDestroy(cust->addr); }
if(cust->addr != NULL) {
gncAddressBeginEdit(cust->addr);
gncAddressDestroy(cust->addr);
}
gncCustomerBeginEdit(cust);
cust->addr = addr;
gncCustomerCommitEdit(cust);
@ -456,7 +461,10 @@ qofCustomerSetShipAddr (GncCustomer *cust, QofInstance *ship_addr_ent)
if(!cust || !ship_addr_ent) { return; }
ship_addr = (GncAddress*)ship_addr_ent;
if(ship_addr == cust->shipaddr) { return; }
if(cust->shipaddr != NULL) { gncAddressDestroy(cust->shipaddr); }
if(cust->shipaddr != NULL) {
gncAddressBeginEdit(cust->shipaddr);
gncAddressDestroy(cust->shipaddr);
}
gncCustomerBeginEdit(cust);
cust->shipaddr = ship_addr;
gncCustomerCommitEdit(cust);

View File

@ -130,6 +130,7 @@ static void gncEmployeeFree (GncEmployee *employee)
CACHE_REMOVE (employee->username);
CACHE_REMOVE (employee->language);
CACHE_REMOVE (employee->acl);
gncAddressBeginEdit (employee->addr);
gncAddressDestroy (employee->addr);
/* qof_instance_release (&employee->inst); */
@ -287,7 +288,10 @@ qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent)
if(!employee || !addr_ent) { return; }
addr = (GncAddress*)addr_ent;
if(addr == employee->addr) { return; }
if(employee->addr != NULL) { gncAddressDestroy(employee->addr); }
if(employee->addr != NULL) {
gncAddressBeginEdit(employee->addr);
gncAddressDestroy(employee->addr);
}
gncEmployeeBeginEdit(employee);
employee->addr = addr;
gncEmployeeCommitEdit(employee);

View File

@ -134,6 +134,7 @@ static void gncVendorFree (GncVendor *vendor)
CACHE_REMOVE (vendor->id);
CACHE_REMOVE (vendor->name);
CACHE_REMOVE (vendor->notes);
gncAddressBeginEdit (vendor->addr);
gncAddressDestroy (vendor->addr);
g_list_free (vendor->jobs);
@ -322,7 +323,10 @@ qofVendorSetAddr (GncVendor *vendor, QofInstance *addr_ent)
if(!vendor || !addr_ent) { return; }
addr = (GncAddress*)addr_ent;
if(addr == vendor->addr) { return; }
if(vendor->addr != NULL) { gncAddressDestroy(vendor->addr); }
if(vendor->addr != NULL) {
gncAddressBeginEdit(vendor->addr);
gncAddressDestroy(vendor->addr);
}
gncVendorBeginEdit(vendor);
vendor->addr = addr;
gncVendorCommitEdit(vendor);

View File

@ -52,6 +52,7 @@ test_address (void)
address = gncAddressCreate (book, &ent);
do_test (address != NULL, "address create");
gncAddressBeginEdit (address);
gncAddressDestroy (address);
success ("create/destroy");
}