Saving score properties causes a crash

• Jan 3, 2022 - 09:11
Reported version
4.x-dev
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project

Steps to reproduce:

1) Create or open a score
2) Go to File -> Score Properties
3) Change any value and save
4) Pop.

This bug was introduced during the Fixed accessibility for score properties dialog commit. It is because the code is assuming that all properties are labelled by a QLineEdit and the previous change has changed them to a QLabel.

I have a candidate fix for it - I'm just working out how I create a test (I'm new to this open source project - Hi!)

Hopefully I'll have it by the end of the day.


Comments

In reply to by Jojo-Schmitz

Hi - yes - see attached.

It's because there is a static cast of a QLabel to a QLineEdit in scoreproperties.cpp. I've done a bit of refactor so I can create a test but failing a little bit. Shall I create a branch and then post on the forums for help?

I've refactored the getting of the name value pairs for the score properties into a new class which can then be instanced easily and put under test - but I'm failing to instance a QLabel in my unit test (it itself crashed!) - I suspect it is because I don't really understand Qt very well? The initialisation of QLabel crashes in Qt5Core.

TEST_F(ScorePropertiesItemTests, StandardProperty)
{
    //! CASE When assembling a property item with a non editable label
    QLabel label("MyLabel");
    ScorePropertiesItem item(&label, nullptr);

    //! GIVEN I get the label name
    QString labelName = item.Label();

    //! CHECK It is what I expect it to be
    EXPECT_TRUE(labelName == "MyLabel");
}
Attachment Size
Screenshot 2022-01-03 102419.png 48.87 KB
Fix version
4.0.0