bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue 2356 in lilypond: Lilypond segfaults


From: lilypond
Subject: Re: Issue 2356 in lilypond: Lilypond segfaults
Date: Sat, 03 Mar 2012 15:45:08 +0000

Updates:
        Labels: -Patch-new Patch-needs_work

Comment #22 on issue 2356 by address@hidden: 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]