]> git.donarmstrong.com Git - lilypond.git/commitdiff
Implement session-terminate in lily.scm
authorDavid Kastrup <dak@gnu.org>
Thu, 18 Oct 2012 12:47:47 +0000 (14:47 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 18 Oct 2012 16:12:25 +0000 (18:12 +0200)
session-wide variables are now reinitialized _after_ the session
before starting garbage collection statistics and looking for undead
objects.

scm/lily.scm

index b1de941c47d1a5f4beac50710eeb476ff6c889b9..d7c4bf65874c8766fe5a2dcd75bae743fb296258 100644 (file)
@@ -72,6 +72,12 @@ session has started."
      (define-session ,name ,value)
      (export ,name)))
 
+(define (session-terminate)
+  (if (ly:undead? lilypond-declarations)
+      (for-each
+       (lambda (p) (variable-set! (cadr p) (cddr p)))
+       (ly:get-undead lilypond-declarations))))
+
 (define-public (session-initialize thunk)
   "Initialize this session.  The first session in a LilyPond run is
 initialized by calling @var{thunk}, then recording the values of all
@@ -905,6 +911,7 @@ PIDs or the number of the process."
              (mtrace:start-trace  (ly:get-option 'trace-memory-frequency)))
          (lilypond-file handler x)
          (ly:check-expected-warnings)
+         (session-terminate)
          (if start-measurements
              (dump-profile x start-measurements (profile-measurements)))
          (if (ly:get-option 'trace-memory-frequency)