grame-cncm / guidolib

Guido project - music score layout engine - music description language
http://guido.grame.fr
Mozilla Public License 2.0
152 stars 34 forks source link

Octavia on cross-staff can lead to destructor Crash #174

Closed arshiacont closed 10 months ago

arshiacont commented 1 year ago

The following reduced excerpt leads systematically to crash on GuidoFreeGR (if freed after rendering) and more specifically on GRPositionTag::DeleteStaff(GRStaff*).

Hint: If you remove the two \oct, the crash disappears!

{[  (* meas. 1 *)  \clef<"g2"> \key<2> \meter<"C"> 
   \oct<1> \staff<2> \stemsUp \beamBegin:1 {f#2/8, f#3/8  } \staff<1> {f#3/8, f#4/8  } \staff<2> {e2/8, e3/8  } \staff<1> {e3/8, e4/8  } \beamEnd:1 \staff<2> \beamBegin:1 {c#2/8, c#3/8  } \staff<1> {c#3/8, c#4/8  } \staff<2> {\acc( a#1/8)
, \acc( a#2/8)} 
\oct<0> \staff<1> {a#2/8, \acc( a#3/8)} \beamEnd:1 ]
  }
dfober commented 1 year ago

I've been lucky with the previous crash bug since the solution was to remove useless associations. This is not the case here and it looks like a tricky case to solve. This kind of issue has been identified years ago. Automatic memory management is the ultimate solution but that's a huge task. I'll see if I can find a quick solution.

dfober commented 1 year ago

In fact, the crash is caused by the fact that the 2 octavas are on different staffs. It's a slightly ambiguous case: an octava that starts on one staff and ends on another doesn't make much sense graphically. I think it should be possible to resolve this at the AR level.

arshiacont commented 1 year ago

Oh I see! Effectively the octave off here is not normal and does not make sense!! I will fix this in xml2guido! If we can just avoid the engine crash in such cases it would be ideal.

dfober commented 1 year ago

Of course, I'll fix it. Zero crash is the goal.

dfober commented 1 year ago

the crash bug is solved but I have to fix the display

dfober commented 10 months ago

fixed, including incorrect rendering