From 1b01633e2890e4439bdafd1463a8c4023fe84e2e Mon Sep 17 00:00:00 2001 From: hanwen Date: Tue, 31 May 2005 18:50:04 +0000 Subject: [PATCH] * lily/lily-parser-scheme.cc (LY_DEFINE): unprotect paper too. Plugs memory leak. * lily/score.cc (Score): unprotect copy of Output_def. Plugs memory leak. --- ChangeLog | 3 +++ lily/lily-parser-scheme.cc | 10 +++++++--- lily/score.cc | 6 ++++-- lily/stencil-interpret.cc | 1 + scm/define-stencil-commands.scm | 20 ++++++++++++++------ 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c437edecd..bc0ba9b362 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-05-31 Han-Wen Nienhuys + * lily/lily-parser-scheme.cc (LY_DEFINE): unprotect paper + too. Plugs memory leak. + * make/lilypond.fedora.spec.in (Group): remove lilypond-pdfpc-helper. diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index d77dcb3bc3..ab80fff1ec 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -194,7 +194,8 @@ LY_DEFINE (ly_parser_print_score, "ly:parser-print-score", SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG1, __FUNCTION__, "parser"); SCM_ASSERT_TYPE (score, score_smob, SCM_ARG2, __FUNCTION__, "score"); - SCM header = ly_c_module_p (score->header_) ? score->header_ + SCM header = ly_c_module_p (score->header_) + ? score->header_ : parser->lexer_->lookup_identifier ("$globalheader"); File_name outname (parser->output_basename_); @@ -212,12 +213,15 @@ LY_DEFINE (ly_parser_print_score, "ly:parser-print-score", if (score->defs_.is_empty ()) { Output_def *layout = get_layout (parser); - default_rendering (score->get_music (), layout->self_scm (), - get_paper (parser)->self_scm (), + default_rendering (score->get_music (), + layout->self_scm (), + paper, header, os, key->self_scm ()); + scm_gc_unprotect_object (layout->self_scm ()); } + scm_gc_unprotect_object (paper); scm_gc_unprotect_object (key->self_scm ()); return SCM_UNSPECIFIED; } diff --git a/lily/score.cc b/lily/score.cc index cec3cef117..a9029cb21f 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -119,7 +119,9 @@ default_rendering (SCM music, SCM outdef, } SCM context = ly_run_translator (music, scaled_def, key); - Music_output *output = unsmob_music_output (ly_format_output (context)); + + SCM output_as_scm = ly_format_output (context); + Music_output *output = unsmob_music_output (output_as_scm); if (Paper_score *pscore = dynamic_cast (output)) { @@ -137,9 +139,9 @@ default_rendering (SCM music, SCM outdef, paper_book->classic_output (ly_scm2string (outname)); scm_gc_unprotect_object (paper_book->self_scm ()); } - scm_gc_unprotect_object (output->self_scm ()); scm_remember_upto_here_1 (scaled_def); + scm_remember_upto_here_1 (output_as_scm); scm_remember_upto_here_1 (scaled_bookdef); } diff --git a/lily/stencil-interpret.cc b/lily/stencil-interpret.cc index 00441eeebc..f88cdc4c7f 100644 --- a/lily/stencil-interpret.cc +++ b/lily/stencil-interpret.cc @@ -29,6 +29,7 @@ interpret_stencil_expression (SCM expr, } else if (head == ly_symbol2scm ("combine-stencil")) { + for (SCM x = scm_cdr (expr); scm_is_pair (x); x = scm_cdr (x)) interpret_stencil_expression (scm_car (x), func, func_arg, o); return; diff --git a/scm/define-stencil-commands.scm b/scm/define-stencil-commands.scm index 46d315381e..f47015b6f0 100644 --- a/scm/define-stencil-commands.scm +++ b/scm/define-stencil-commands.scm @@ -29,7 +29,15 @@ white-dot white-text embedded-ps - zigzag-line)) + zigzag-line + setcolor + resetcolor + + grob-cause + no-origin + placebox + unknown + )) ;; TODO: ;; - generate this list by registering the output-backend-commands @@ -38,8 +46,8 @@ (define-public (ly:all-output-backend-commands) "Return list of output backend commands." - '( - grob-cause - no-origin - placebox - unknown)) + '(combine-stencil + color + translate-stencil)) + +(map ly:register-stencil-expression (ly:all-output-backend-commands)) -- 2.39.5