Skip to content

Conversation

@cbjeukendrup
Copy link
Member

Resolves: #30934

The "phantom arrows" mentioned in the issue were caused by an unsafe static_cast in rowCount, casting a StaffItem to a PartItem, resulting in garbage being read from the resulting part->staves.size(). This garbage might be a huge number, causing a huge number of rows to be inserted into the model, to the point that the application (or even the OS) crashes with out-of-memory errors.

The index method also contains a similar static_cast; this one is not problematic, but by principle, I've made this one safe(r) as well. Now we only ever static_cast to Item, which is justifiable.

Resolves: musescore#30934

The "phantom arrows" mentioned in the issue were caused by an unsafe `static_cast` in `rowCount`, casting a `StaffItem` to a `PartItem`, resulting in garbage being read from the resulting `part->staves.size()`. This garbage might be a huge number, causing a huge number of rows to be inserted into the model, to the point that the application (or even the OS) crashes with out-of-memory errors.

The `index` method also contains a similar `static_cast`; this one is not problematic, but by principle, I've made this one safe(r) as well. Now we only ever `static_cast` to `Item`, which is justifiable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash involving hidden staff popup

2 participants