AUDIT: r16836 - gnucash/trunk/src - Prevent crashing when a report template disappears (#505921).
Andrew Sackville-West
andrew at swclan.homelinux.org
Thu Feb 28 23:27:40 EST 2008
On Thu, Feb 28, 2008 at 10:02:32PM +0100, Andreas Köhler wrote:
> Hi Andrew,
howdy
>
> please tell me whether I can push the attachment, as r16836 did not
> apply cleanly. Thanks.
It looks good to me. I'm not sure what you did that's different, so I
guess that's a good thing. We should internationalize that string as
well, I suppose, but that puts new strings in the stable branch. :( I
don't know how we handle that.
A
>
> -- andi5
>
> commit d20ece301f13032a9a9f77b5817adc4a4d99886e
> Author: Andreas Köhler <andi5.py at gmx.net>
> Date: Thu Feb 28 21:56:08 2008 +0100
>
> [r16836] Prevent crashing when a report template disappears (#505921).
>
> If a report template is missing (renamed, moved, deleted, whatever)
> while the report is still open, then the app will crash while reading
> the books file. The options-generator will fail and cause subsequent
> attempts to access the options to fail and crash. A couple checks for
> the existence of options is all it takes. Also included a warning dialog.
>
> diff --git a/src/app-utils/options.scm b/src/app-utils/options.scm
> index 4b132fe..375411a 100644
> --- a/src/app-utils/options.scm
> +++ b/src/app-utils/options.scm
> @@ -1464,7 +1464,9 @@
> ((options 'for-each-general) section-thunk option-thunk))
>
> (define (gnc:lookup-option options section name)
> - ((options 'lookup) section name))
> + (if options
> + ((options 'lookup) section name)
> + #f))
>
> (define (gnc:generate-restore-forms options options-string)
> ((options 'generate-restore-forms) options-string))
> diff --git a/src/report/report-system/report.scm b/src/report/report-system/report.scm
> index 0dc7a73..889e969 100644
> --- a/src/report/report-system/report.scm
> +++ b/src/report/report-system/report.scm
> @@ -282,15 +282,23 @@
>
> ;; This is the function that is called when saved reports are evaluated.
> (define (gnc:restore-report id template-name options)
> - (let ((r ((record-constructor <report>)
> - template-name id options #t #t #f #f)))
> - (gnc-report-add r))
> + (if options
> + (let ((r ((record-constructor <report>)
> + template-name id options #t #t #f #f)))
> + (gnc-report-add r))
> + (begin
> + (gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
> + #f))
> )
>
> ;; dummy function to enable backwards compatibility with newer reports
> (define (gnc:restore-report-by-guid id template-id template-name options)
> - (gnc:restore-report id template-name options))
> -
> + (if options
> + (gnc:restore-report id template-name options)
> + (begin
> + (gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
> + #f))
> + )
>
> (define (gnc:make-report-options template-name)
> (let ((template (hash-ref *gnc:_report-templates_* template-name)))
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20080228/6bef42ff/attachment.bin
More information about the gnucash-devel
mailing list