[Gnucash-changes] r12989 - gnucash/trunk/src/report - Check for
invalid options tables when loading reports.
Chris Shoemaker
c.shoemaker at cox.net
Fri Jan 27 01:21:23 EST 2006
Christian,
I'm not able to test more than one report right now, but I
think this will fix Bug 326578 – SVN crashes on opening 1.8 datafile
with renamed reports. This was pretty ugly behavior. When I finally
got the right bug, it wasn't showing an error report page - just a
stack trace. I'm glad it won't be in 1.9.0. :)
If this doesn't work, please let me know.
-chris
On Fri, Jan 27, 2006 at 01:15:33AM -0500, Chris Shoemaker wrote:
> Author: chris
> Date: 2006-01-27 01:15:31 -0500 (Fri, 27 Jan 2006)
> New Revision: 12989
> Trac: http://svn.gnucash.org/trac/changeset/12989
>
> Modified:
> gnucash/trunk/src/report/report-gnome/window-report.c
> gnucash/trunk/src/report/report-system/report.scm
> Log:
> Check for invalid options tables when loading reports.
> Also, plug memory leak in my last commit.
>
>
> Modified: gnucash/trunk/src/report/report-gnome/window-report.c
> ===================================================================
> --- gnucash/trunk/src/report/report-gnome/window-report.c 2006-01-27 05:27:08 UTC (rev 12988)
> +++ gnucash/trunk/src/report/report-gnome/window-report.c 2006-01-27 06:15:31 UTC (rev 12989)
> @@ -323,7 +323,13 @@
> 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
>
> Modified: gnucash/trunk/src/report/report-system/report.scm
> ===================================================================
> --- gnucash/trunk/src/report/report-system/report.scm 2006-01-27 05:27:08 UTC (rev 12988)
> +++ gnucash/trunk/src/report/report-system/report.scm 2006-01-27 06:15:31 UTC (rev 12989)
> @@ -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)))
>
> _______________________________________________
> gnucash-changes mailing list
> gnucash-changes at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-changes
More information about the gnucash-devel
mailing list