Don't leak a file port when saving reports.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18515 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2009-12-17 07:33:26 +00:00
parent fa9f788504
commit 3ca3f9e72f

View File

@ -576,10 +576,9 @@
;; #Bug#342206. ;; #Bug#342206.
(save-result (eval-string saved-form))) (save-result (eval-string saved-form)))
(if (record? save-result) (if (record? save-result)
(begin (let ((report-port (open-file conf-file-name "a")))
(display saved-form (display saved-form report-port)
(open-file conf-file-name "a")) (close report-port)
(force-output)
(let ((report-name (gnc:report-name report))) (let ((report-name (gnc:report-name report)))
(gnc-info-dialog (gnc-info-dialog
'() '()
@ -592,11 +591,11 @@
)))) ))))
(define (gnc:report-template-save-to-savefile report-template) (define (gnc:report-template-save-to-savefile report-template)
(let ((conf-file-name gnc:current-saved-reports) (let* ((conf-file-name gnc:current-saved-reports)
(saved-form (gnc:report-template-generate-saved-forms report-template))) (saved-form (gnc:report-template-generate-saved-forms report-template))
(display saved-form (report-port (open-file conf-file-name "a")))
(open-file conf-file-name "a")) (display saved-form report-port)
(force-output))) (close report-port)))
;; save all custom reports, moving the old version of the ;; save all custom reports, moving the old version of the
;; saved-reports file aside as a backup ;; saved-reports file aside as a backup