Updates:
        Labels: -Patch-new Patch-needs_work

Comment #22 on issue 2356 by [email protected]: Lilypond segfaults
http://code.google.com/p/lilypond/issues/detail?id=2356

Mike, we have the following:
class Span_bar_stub_engraver : public Engraver
{
  vector<Grob *> spanbars_;
  map<Grob *, Context *> axis_groups_;

_None_ of all that, as far as I can see, is getting marked _anywhere_. This is a garbage collection disaster waiting to happen. Wait, it already happens. Which is what this issue is about.

Now one can mark all this, sure. But walking through a map is effort. Is there a reason you are using a C++ map here instead of a Scheme hashtable? A Scheme hashtable only needs to get marked on its own and will keep its contents alive (or, if it is a weak hashtable, deal with their demise on its own).

If you don't want to rewrite things, just create a derived_mark member function (it is called from translator.cc as a virtual function) for your engraver, and let it call scm_gc_mark on all values in your map.

That's the way to do this sort of protection thing.


_______________________________________________
bug-lilypond mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to