From 27aab601d8c1322e90a5410486b20f9f7f271bc3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 21 Nov 2004 18:30:59 +0000 Subject: [PATCH] * lily/grob.cc (Grob): idem. Plugs mem leaks. * lily/context.cc (Context): unprotect key from ctor. * lily/parser.yy (lilypond_header_body): copy previous $globalheader if present. * lily/ly-module.cc (LY_DEFINE): rename ly:import-module to ly:module-copy * scm/page-layout.scm (marked-up-headfoot): remove old functions. * scm/titling.scm: remove old titling functions * scm/page-layout.scm (marked-up-headfoot): create header/footer field from user-supplied markup * scm/titling.scm (marked-up-title): create title via user-specified markup. * lily/ly-module.cc (LY_DEFINE): use ly_module_lookup(). This does not have side-effect of creating variable stub. --- ChangeLog | 4 ++++ lily/context-property.cc | 1 - lily/context.cc | 3 +-- lily/global-context.cc | 3 --- lily/grob.cc | 4 ++++ lily/score-engraver.cc | 4 ---- lily/score.cc | 1 + scm/lily.scm | 10 +++++----- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56186211f7..e0c1541aa6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-11-21 Han-Wen Nienhuys + * lily/grob.cc (Grob): idem. Plugs mem leaks. + + * lily/context.cc (Context): unprotect key from ctor. + * scm/stencil.scm (stack-lines): return empty-stencil if argument is '() (stack-stencils): idem. diff --git a/lily/context-property.cc b/lily/context-property.cc index bd5ccbf7b8..496b9b120b 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -203,7 +203,6 @@ make_item_from_properties (Engraver *tr, SCM x, SCM cause, const char * name) Object_key const*key = context->get_grob_key (name); Item *it = new Item (props, key); - scm_gc_unprotect_object (key->self_scm ()); dynamic_cast(tr)->announce_grob (it, cause); diff --git a/lily/context.cc b/lily/context.cc index c85d5a6cbd..effb574d1c 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -98,9 +98,9 @@ Context::Context (Object_key const* key) definition_ = SCM_EOL; smobify_self (); - properties_scm_ = (new Scheme_hash_table)->self_scm (); scm_gc_unprotect_object (properties_scm_); + scm_gc_unprotect_object (key_->self_scm ()); } @@ -181,7 +181,6 @@ Context::create_context (Context_def * cdef, Object_key const *key = get_context_key (type, id); Context * new_group = cdef->instantiate (ops, key); - scm_gc_unprotect_object (key->self_scm ()); new_group->id_string_ = id; add_context (new_group); diff --git a/lily/global-context.cc b/lily/global-context.cc index 7acf004cf1..e7be444321 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -24,8 +24,6 @@ Global_context::Global_context (Output_def *o, Moment final, Object_key *key) Moment(0), "Global", "", 0)) { - scm_gc_unprotect_object (key_->self_scm()); - output_def_ = o; final_mom_ = final; definition_ = find_context_def (o, ly_symbol2scm ("Global")); @@ -167,7 +165,6 @@ Global_context::run_iterator_on_me (Music_iterator * iter) Object_key const *key = get_context_key ("Score", ""); Context *c = t->instantiate (SCM_EOL, key); add_context (c); - scm_gc_unprotect_object (key->self_scm()); Score_context *sc = dynamic_cast (c); sc->prepare (w); diff --git a/lily/grob.cc b/lily/grob.cc index c6e442ec53..c2d6a2d049 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -59,6 +59,10 @@ Grob::Grob (SCM basicprops, GC. After smobify_self (), they are. */ smobify_self (); + /* + We always get a new key object for a new grob. + */ + scm_gc_unprotect_object (key_->self_scm ()); SCM meta = get_property ("meta"); if (scm_is_pair (meta)) { diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index f99ed6151d..221a32ec07 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -53,9 +53,6 @@ Score_engraver::make_columns () set_columns (new Paper_column (nmp, key1), new Paper_column (pc, key2)); - scm_gc_unprotect_object (key1->self_scm()); - scm_gc_unprotect_object (key2->self_scm()); - Grob_info i1; i1.grob_ = command_column_; i1.origin_trans_ = this; @@ -125,7 +122,6 @@ Score_engraver::initialize () Object_key const *sys_key = context()->get_grob_key ("System"); pscore_->typeset_line (new System (props, sys_key)); - scm_gc_unprotect_object (sys_key->self_scm ()); make_columns (); system_ = pscore_->system_; diff --git a/lily/score.cc b/lily/score.cc index b758fde169..453a72a73e 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -252,6 +252,7 @@ Score::book_rendering (String outname, Object_key * key = new Lilypond_general_key (book_key, user_key_, 0); SCM scm_key = key->self_scm(); + scm_gc_unprotect_object (scm_key); for (int i = 0; !i || i < outdef_count; i++) { diff --git a/scm/lily.scm b/scm/lily.scm index fd0ae671cd..c1a0bdd125 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -248,12 +248,12 @@ predicates. Print a message at LOCATION if any predicate failed." (lambda (a b) (< (object-address (car a)) (object-address (car b)))))) - (outfile (open-file (string-append + (out-file-name (string-append "gcstat-" (number->string gc-protect-stat-count) - ".scm" - ) "w"))) + ".scm")) + (outfile (open-file out-file-name "w"))) - (display "DUMPING...\n") + (display "Dumping gc protected objs to ...\n") (display (filter (lambda (x) (not (symbol? x))) @@ -333,7 +333,7 @@ predicates. Print a message at LOCATION if any predicate failed." (for-each (lambda (f) (catch 'ly-file-failed (lambda () (ly:parse-file f)) handler) -;;; (dump-gc-protects) + (dump-gc-protects) ) files) -- 2.39.2