#1260 Crash on Undo Add Layer

notation (282)

Draw a segment. Open in notation view. Click Add Layer button. Undo. BOOM!

Must fix before releasing again!


  • Thorsten Alteholz

    In HeadersGroup::slotSetCurrentSegment() the m_scene->getCurrentStaff() delivers a null pointer and BOOM.

    getCurrentStaff() becomes invalid in NotationScene::segmentRemoved() after m_staffs.erase(i) (thats what it should do)

    I tried to use setCurrentStaff() afterwards and could avoid the initial BOOM. Unfortunately now any other action in the notation editor gave a crash.

    I am lost now and hope anybody with more insight can go on ...


  • Yves Guillemot

    Yves Guillemot - 2010-03-29

    The real problem seems related to the segment creation rather than to the undo action:

    Test 1:
    - Draw a segment on track 1
    - Draw a second segment at the same place on the same track (I draw it on the track 2 then I move it).
    - Open the two segments in notation
    - Delete the second one from the main window : no problem.

    Test 2:
    - Draw a segment on track 1
    - Open it in notation
    - Add a layer with the button
    - Delete the new layer segment from the main window : crash.

    So, from the notation editor point of view, there is a difference between the segment created with the add layer button and a "normal" segment.

    I had a first quick look to the add layer code, but didn't see anything obviously wrong.

    I will try to have a more extensive look in the next days.


  • Yves Guillemot

    Yves Guillemot - 2010-04-04

    I was wrong : the crashes are related to the undo (or trigged by the undo).

    Two crash types should be fixed now :

    1 - Crash when deleting the last segment of the notation view and when this last segment is the current one. That was always the case when undoing a add layer done from an editor opened on an unique segment.
    To fix it, when the current segment is going to be deleted, the first segment of the view is now set as the current one.

    2 - When the preceding crash is fixed, a new crash occurs when entering a note on the remaining segment after an undo.
    The problem is related to the chord name ruler which maintains a list of the segments.
    A deleted segment is not removed from this list, and the chord ruler is sometimes referencing it. This is true whatever way is used to delete the segment, but, for some reason, the undo activates the crash while the delete from the main window does not.
    Probably some other tools was also keeping a pointer to deleted segments, but I saw only crashes coming from the chord name ruler.
    The fix is to always regenerate the whole notation widget when a segment is deleted.

    Now at least a third crash may occur :

    1 - open an empty segment in notation
    2 - add a layer
    3 - select the initial segment with the changer tool
    4 - select the selection tool
    5 - select some rests
    6 - undo the add layer
    7 - select the pencil tool : boom !

    I have no fix for this one still.


  • Yves Guillemot

    Yves Guillemot - 2010-04-05

    That last crash should now be fixed in rev. 11862.


  • D. Michael McIntyre

    I ran through all scenarios discussed here, and all crashes appear to be fixed. Nice work, Yves!


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks