* lily/lily-parser-scheme.cc (LY_DEFINE): unprotect paper
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 31 May 2005 18:50:04 +0000 (18:50 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 31 May 2005 18:50:04 +0000 (18:50 +0000)
too. Plugs memory leak.

* lily/score.cc (Score): unprotect copy of Output_def. Plugs
memory leak.

ChangeLog
lily/lily-parser-scheme.cc
lily/score.cc
lily/stencil-interpret.cc
scm/define-stencil-commands.scm

index 9c437edecdc1fafcd2108d28a114e473d8c0deae..bc0ba9b3629235795ac944a0e9b0d73c31e45b03 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-05-31  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/lily-parser-scheme.cc (LY_DEFINE): unprotect paper
+       too. Plugs memory leak.
+
        * make/lilypond.fedora.spec.in (Group): remove
        lilypond-pdfpc-helper.
 
index d77dcb3bc35edeeb8bf7dbc693cda802d674ed10..ab80fff1ec75090ab6766d5af99dee75fbfe75df 100644 (file)
@@ -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;
 }
index cec3cef117f79ea3b2b2310fe0b28ea2e2dfa7f2..a9029cb21fa64ec17441650088b76797597f9fd3 100644 (file)
@@ -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<Paper_score*> (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);
 }
 
index 00441eeebc13e7ab50db75ab40dea137dc6687f6..f88cdc4c7fd0593ddac254c842a35f9267fac99b 100644 (file)
@@ -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;
index 46d315381ea674d710f269f4e797beb7803773ce..f47015b6f0f77d68fc07aeba61091182b68e8172 100644 (file)
        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))