Crash when inserting staff or system text after a staff or system text over more lines

• Sep 18, 2013 - 17:35
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Steps:

  1. Create a new score and insert two notes.
  2. Select the first note, Ctrl + T (or Ctrl + Shift + T) and insert "a (return) a", where (return) means return key (to make the text span over two lines).
  3. Click outside to exit text edit mode.
  4. Select the second note, Ctrl + T (or Ctrl + Shift + T) and insert any character. -> crash

Windows 8, Nightly build 9491c2a (the number of Windows Nightly build looks strange, the commit is 14769730 )

Note: no crash if the same steps are performed for lyrics (Ctrl + L).


Comments

The crash happens at instruction deleteSelectedText(); at line 557 of libmscore\simpletext.cpp.
It seems that the _cursor.selectLine and _cursor.selectColumn are not reset to 0 in a new text command and they keep the values from the previous text command. In particular since selectLine and/or selectColumn are different from line or column (which are correctly set to 0), the text is treated as if it had a selection. When this (not existent) selection is being deleted, it causes the crash.
Indeed, if the cursor is placed at the beginning of the first text (i.e. selectLine, selectColumn, line and column are set to 0) before step 3 above, step 4 does not crash.