crash on chord symbol entry after undo of chord style change

• Mar 2, 2014 - 17:24
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Windows 7, GIT commit: 06a7a75

1) new score
2) add a chord symbol - Ctrl+K C7 Esc
3) Style / General / Chord Symbols
4) Appearance: change from Standard to Jazz
5) OK
6) Undo
7) select full measure rest in an empty measure
7) add a chord symbol different from first: Ctrl+K Cmi7 Esc

Result: crash

This is another manifestation of the same basic problem as #23950: Crash after closing score if loading style that defines chord id and #23957: Crash on chord symbol entry after load of style, but this one doesn't involve loading style files - just the normal style dialog. I was working on those trying to address the symptoms, but this one shows the underlying cause is deeper.

The basic problem is in copying of styles, and specifically, the copying of the chordList. The chordList is populated as you add chords to a score (or if you load certain chord description files). Every time a style is copied, the chordList is copied, but the contents are not necessarily deep-copied. So if one copy of a chordList is cleared, this can affect the contents of the other copies of the same chordList. I know Qt tries to manage this by keeping reference counts, and the chordList destructor tries to avoid deleting the contents of the list if they are used elsewhere. But somehow, it isn't working. These three bugs all result from cases of one copy of a chordList being destructed or cleared and this corrupting the contents of another copy.

I can "solve" all three problems by commenting out the delete statement in the chordList destructor (which effectively renders the destructor a no-op). Of course, I'm not at all happy with that as it results in a memory leak, but I have no easy way of judging how bad.


Comments