]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/my-lily-parser.cc (LY_DEFINE): plug memory leak: unprotect
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 1 Aug 2004 14:10:14 +0000 (14:10 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 1 Aug 2004 14:10:14 +0000 (14:10 +0000)
parser.

* lily/include/my-lily-lexer.hh (class Lily_lexer): smobify lexer.

ChangeLog
VERSION
lily/include/my-lily-lexer.hh
lily/my-lily-parser.cc
scm/lily.scm

index bc3bc92449b3646f64557196c18155d12467df1c..7729ba0313d0d6b6e56bf7590bf4c4931120000d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,14 @@
 2004-08-01  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/my-lily-parser.cc (LY_DEFINE): plug memory leak: unprotect
+       parser.
+
+       * lily/include/my-lily-lexer.hh (class Lily_lexer): smobify lexer.
+
        * lily/include/my-lily-parser.hh: rename My_lily -> Lily
 
        * make/mutopia-targets.make (local-WWW): don't make ps.gz
-       examples. They take huge amounts of space.
+       examples. They take a huge amount of space.
 
        * Documentation/user/GNUmakefile: fix symlinks.
 
diff --git a/VERSION b/VERSION
index e672b3863f16fad2be3509e93306a92489b1b503..293ef2240f48561f2e83dae9fec8ff72f33cf9cc 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=3
 PATCH_LEVEL=10
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hwn1
 
index b3c32f6f5273938ae9a1221e63c3f0d3320541ee..b697068bcd99f52aaa99ee12c55bc3907e784902 100644 (file)
@@ -59,8 +59,6 @@ public:
 
   Lily_lexer (Sources*);
   Lily_lexer (Lily_lexer const&);
-  ~Lily_lexer ();
-
   int yylex ();
 
   void prepare_for_next_token ();
index c271d4ed297e566ff55dbb7167aca5b374f86cda..5a5c06814d6131e55867588873cea72bcbf9ad76 100644 (file)
@@ -86,6 +86,7 @@ void
 Lily_parser::parse_file (String init, String name, String out_name)
 {
   lexer_ = new Lily_lexer (sources_);
+  scm_gc_unprotect_object (lexer_->self_scm ());
   // TODO: use $parser 
   lexer_->set_identifier (ly_symbol2scm ("parser"),
                          self_scm ());
@@ -111,8 +112,6 @@ Lily_parser::parse_file (String init, String name, String out_name)
     }
 
   error_level_ = error_level_ | lexer_->error_level_;
-
-  scm_gc_unprotect_object (lexer_->self_scm ());
   lexer_ = 0;
 }
 
@@ -122,6 +121,7 @@ Lily_parser::parse_string (String ly_code)
   Lily_lexer *parent = lexer_;
   lexer_ = (parent == 0 ? new Lily_lexer (sources_)
            : new Lily_lexer (*parent));
+  scm_gc_unprotect_object (lexer_->self_scm ());
 
 
   SCM oldmod = scm_current_module ();
@@ -159,7 +159,6 @@ Lily_parser::parse_string (String ly_code)
     }
 
   scm_set_current_module (oldmod);
-  scm_gc_unprotect_object (lexer_->self_scm ());
   lexer_ = 0;
 }
 
@@ -302,6 +301,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file",
       parser->parse_file (init, file_name, out_file);
 
       bool error = parser->error_level_;
+      scm_gc_unprotect_object (parser->self_scm ());
       parser = 0;
       if (error)
        /* TODO: pass renamed input file too.  */
@@ -324,6 +324,7 @@ LY_DEFINE (ly_parse_string, "ly:parse-string",
   scm_module_define (global_lily_module, ly_symbol2scm ("parser"),
                     parser->self_scm ());
   parser->parse_string (ly_scm2string (ly_code));
+  scm_gc_unprotect_object (parser->self_scm ());
   parser = 0;
   
   return SCM_UNSPECIFIED;
index 1e4ef64b95a8f76ddc801cadc9e31a0db26b20bd..a9339f97b7e201cf0457cbcc104438a822fe5e34 100644 (file)
@@ -531,8 +531,7 @@ L1 is copied, L2 not.
        (outfile    (open-file (string-append
               "gcstat-" (number->string gc-protect-stat-count)
               ".scm"
-              ) "w"))
-       )
+              ) "w")))
 
     (display "DUMPING...\n")
     (display
@@ -593,7 +592,10 @@ L1 is copied, L2 not.
   (let* ((failed '())
         (handler (lambda (key arg) (set! failed (cons arg failed)))))
     (for-each
-     (lambda (f) (catch 'ly-file-failed (lambda () (ly:parse-file f)) handler))
+     (lambda (f)
+       (catch 'ly-file-failed (lambda () (ly:parse-file f)) handler)
+       (dump-gc-protects)
+       )
      files)
 
     (if (pair? failed)