]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/book.cc
plug memory leak in book identifiers.
[lilypond.git] / lily / book.cc
index 114ef0cdf2df8cc5c56bedef16beb90f3c68a4a4..2bf7b585752bc7c199c050efa0061078ad34c412 100644 (file)
 using namespace std;
 
 #include "lilypond-key.hh"
-#include "global-context.hh"
 #include "main.hh"
-#include "music-iterator.hh"
-#include "music-output.hh"
 #include "music.hh"
 #include "output-def.hh"
 #include "paper-book.hh"
 #include "score.hh"
-#include "stencil.hh"
 #include "text-interface.hh"
 #include "warn.hh"
-
 #include "performance.hh"
 #include "paper-score.hh"
 
@@ -49,13 +44,17 @@ Book::Book (Book const &s)
   smobify_self ();
 
   if (s.paper_)
-    paper_ = s.paper_->clone ();
+    {
+      paper_ = s.paper_->clone ();
+      paper_->unprotect ();
+    }
   
   input_location_ = make_input (*s.origin ());
+
   header_ = ly_make_anonymous_module (false);
   if (ly_is_module (s.header_))
     ly_module_copy (header_, s.header_);
-
+  
   SCM *t = &scores_;
   for (SCM p = s.scores_; scm_is_pair (p); p = scm_cdr (p))
     {
@@ -118,7 +117,7 @@ Paper_book *
 Book::process (Output_def *default_paper,
               Output_def *default_layout)
 {
-  for (SCM s = scores_; s != SCM_EOL; s = scm_cdr (s))
+  for (SCM s = scores_; scm_is_pair (s); s = scm_cdr (s))
     if (Score *score = unsmob_score (scm_car (s)))
       if (score->error_found_)
        return 0;
@@ -140,7 +139,7 @@ Book::process (Output_def *default_paper,
   paper_book->header_ = header_;
 
   /* Render in order of parsing.  */
-  for (SCM s = scm_reverse (scores_); s != SCM_EOL; s = scm_cdr (s))
+  for (SCM s = scm_reverse (scores_); scm_is_pair (s); s = scm_cdr (s))
     {
       if (Score *score = unsmob_score (scm_car (s)))
        {