[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nested contexts - fix
From: |
Rune Zedeler |
Subject: |
Nested contexts - fix |
Date: |
Mon, 29 Oct 2007 06:34:48 +0100 |
User-agent: |
Thunderbird 1.5.0.14pre (X11/20071022) |
Back in 2001 I made a patch to allow for nested StaffGroups.
Unfortunately the introduced cycle in the context-hierarchy introduced a
infinite loop in lilypond, leading to a stack overflow.
I therefore replaced the nested StaffGroups with StaffGroup and
InnerStaffGroup - as some sort of temporary solution. But here, after 6
years, they are still there.
Tried to push patch to my branch in git, but as stated in other mail, I
have git problems.
So I attached patch instead.
Afaics the attached patch fixes the simple "Context pointing directly to
itself" version of the problem (i.e. it does NOT fix A->B->A style
loops). I think that applying this patch will allow for StaffGroups to
accept StaffGroups - so the we can discontinue use of InnerStaffGroup
and InnerChoirStaff for anything but staffgroups containing choirstaves
and vice verca.
-Rune
diff --git a/lily/context-def.cc b/lily/context-def.cc
index f4023a0..760547f 100644
--- a/lily/context-def.cc
+++ b/lily/context-def.cc
@@ -223,13 +223,16 @@ Context_def::path_to_acceptable_context (SCM type_sym,
Output_def *odef) const
{
Context_def *g = accepteds[i];
- vector<Context_def*> result
- = g->path_to_acceptable_context (type_sym, odef);
- if (result.size () && result.size () < best_depth)
+ if (g!=this)
{
- best_depth = result.size ();
- result.insert (result.begin (), g);
- best_result = result;
+ vector<Context_def*> result
+ = g->path_to_acceptable_context (type_sym, odef);
+ if (result.size () && result.size () < best_depth)
+ {
+ best_depth = result.size ();
+ result.insert (result.begin (), g);
+ best_result = result;
+ }
}
}
- Nested contexts - fix,
Rune Zedeler <=