Free Jobs for Customers and Vendors on book close

This commit is contained in:
Robert Fewell 2021-07-13 15:09:11 +01:00
parent c2a6f1e911
commit b421b3d2af
4 changed files with 17 additions and 0 deletions

View File

@ -353,6 +353,8 @@ static void gncCustomerFree (GncCustomer *cust)
gncAddressDestroy (cust->addr);
gncAddressBeginEdit (cust->shipaddr);
gncAddressDestroy (cust->shipaddr);
gncJobFreeList (cust->jobs);
g_list_free (cust->jobs);
g_free (cust->balance);

View File

@ -231,6 +231,18 @@ GncJob *gncJobCreate (QofBook *book)
return job;
}
static void free_job_list (GncJob *job)
{
gncJobBeginEdit (job);
gncJobDestroy (job);
}
void gncJobFreeList (GList *jobs)
{
GList *job_list = g_list_copy (jobs);
g_list_free_full (job_list, (GDestroyNotify)free_job_list);
}
void gncJobDestroy (GncJob *job)
{
if (!job) return;

View File

@ -57,6 +57,7 @@ GType gnc_job_get_type(void);
GncJob *gncJobCreate (QofBook *book);
void gncJobDestroy (GncJob *job);
void gncJobFreeList (GList *jobs);
/** \name Set Functions
@{

View File

@ -496,6 +496,8 @@ static void gncVendorFree (GncVendor *vendor)
CACHE_REMOVE (vendor->notes);
gncAddressBeginEdit (vendor->addr);
gncAddressDestroy (vendor->addr);
gncJobFreeList (vendor->jobs);
g_list_free (vendor->jobs);
g_free (vendor->balance);