processing files.
+2005-07-25 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * scm/lily.scm (lilypond-all): clear anonymous modules after
+ processing files.
+
2005-07-24 Han-Wen Nienhuys <hanwen@xs4all.nl>
* flower/include/guile-compatibility.hh (SCM_I_CONSP): add
SCM ly_module_symbols (SCM mod);
void ly_reexport_module (SCM mod);
inline bool ly_is_module (SCM x) { return SCM_MODULEP (x); }
-void ly_clear_anonymous_modules ();
+SCM ly_clear_anonymous_modules ();
SCM ly_use_module (SCM mod, SCM used);
#endif /* LY_MODULE_HH */
#include "warn.hh"
#include "context.hh"
+#include "translator.icc"
+
/*
* This abstract class provides the general framework for ligatures of
* any kind. It cares for handling start/stop ligatures events and
void
Ligature_engraver::acknowledge_rest (Grob_info info)
{
- info.music_cause ()->origin ()->warning (_ ("ignoring rest: ligature may not contain rest"));
- prev_start_event_->origin ()->warning (_ ("ligature was started here"));
- // TODO: maybe better should stop ligature here rather than
- // ignoring the rest?
+ if (ligature_)
+ {
+ info.music_cause ()->origin ()->warning (_ ("ignoring rest: ligature may not contain rest"));
+ prev_start_event_->origin ()->warning (_ ("ligature was started here"));
+ // TODO: maybe better should stop ligature here rather than
+ // ignoring the rest?
+ }
}
-#include "translator.icc"
-
ADD_ACKNOWLEDGER(Ligature_engraver, rest);
ADD_ACKNOWLEDGER(Ligature_engraver, note_head);
ADD_TRANSLATOR (Ligature_engraver,
#include "warn.hh"
#include "main.hh"
#include "string.hh"
+#include "protected-scm.hh"
+
+#define MODULE_GC_KLUDGE
#define FUNC_NAME __FUNCTION__
+Protected_scm anonymous_modules = SCM_EOL;
+
+LY_DEFINE(ly_clear_anonymous_modules, "ly:clear-anonymous-modules",
+ 0,0,0,(),
+ "Plug a GUILE 1.6 and 1.7 memory leak by breaking a weak reference "
+ "pointer cycle explicitly."
+ )
+{
+#ifdef MODULE_GC_KLUDGE
+ for (SCM s = anonymous_modules;
+ scm_is_pair (s);
+ s = scm_cdr (s))
+ {
+ SCM module = scm_car (s);
+ SCM closure = SCM_MODULE_EVAL_CLOSURE(module);
+ SCM prop = scm_procedure_property (closure, ly_symbol2scm ("module"));
+
+ if (ly_is_module (prop))
+ {
+ scm_set_procedure_property_x (closure, ly_symbol2scm ("module"),
+ SCM_BOOL_F);
+ }
+ }
+
+ anonymous_modules = SCM_EOL;
+
+#endif
+
+ return SCM_UNSPECIFIED;
+}
+
SCM
ly_make_anonymous_module (bool safe)
{
SCM proc = ly_lily_module_constant ("make-safe-lilypond-module");
mod = scm_call_0 (proc);
}
+
+#ifdef MODULE_GC_KLUDGE
+ anonymous_modules = scm_cons (mod, anonymous_modules);
+#endif
+
return mod;
}
(let* ((failed '())
(handler (lambda (key failed-file)
(set! failed (append (list failed-file) failed)))))
- ;;(handler (lambda (key . arg) (set! failed (append arg failed)))))
- (for-each (lambda (x) (lilypond-file handler x)) files)
+ (for-each
+ (lambda (x)
+ (lilypond-file handler x)
+ (ly:clear-anonymous-modules))
+ files)
failed))
(define (lilypond-file handler file-name)