Check for invalid options tables when loading reports.

Also, plug memory leak in my last commit.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12989 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker 2006-01-27 06:15:31 +00:00
parent 2bc6934c31
commit 6f5ef9f974
2 changed files with 15 additions and 8 deletions

View File

@ -323,7 +323,13 @@ static gboolean
remove_invalid_report(gpointer key, gpointer val, gpointer data)
{
SCM report = val;
return (NULL == gnc_report_name(report));
gchar *name = NULL;
if (NULL == (name = gnc_report_name(report)))
return TRUE;
g_free(name);
return FALSE;
}
static void

View File

@ -269,7 +269,7 @@
(if (>= id *gnc:_report-next-serial_*)
(set! *gnc:_report-next-serial_* (+ id 1)))
(gnc:report-add id r)
id))
#f))
(define (gnc:make-report-options template-name)
@ -305,9 +305,11 @@
#f)))
(define (gnc:report-name report)
(gnc:option-value
(gnc:lookup-option (gnc:report-options report)
gnc:pagename-general gnc:optname-reportname)))
(let* ((opt (gnc:report-options report)))
(if opt
(gnc:option-value
(gnc:lookup-option opt gnc:pagename-general gnc:optname-reportname))
#f)))
(define (gnc:report-stylesheet report)
(gnc:html-style-sheet-find
@ -340,9 +342,8 @@
(define (gnc:report-generate-restore-forms report)
;; clean up the options if necessary. this is only needed
;; in special cases.
(let* ((template
(hash-ref *gnc:_report-templates_*
(gnc:report-type report)))
(let* ((report-type (gnc:report-type report))
(template (hash-ref *gnc:_report-templates_* report-type))
(thunk (gnc:report-template-options-cleanup-cb template)))
(if thunk
(thunk report)))