Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MU4 Issue] MacOS Crash on Plugin with TextField Component #19326

Open
TrebledJ opened this issue Sep 8, 2023 · 8 comments · May be fixed by #20537
Open

[MU4 Issue] MacOS Crash on Plugin with TextField Component #19326

TrebledJ opened this issue Sep 8, 2023 · 8 comments · May be fixed by #20537
Assignees
Labels
community Issues we would like the community to address crash Issues involving a crash of MuseScore P1 Priority: High plugins Related to MuseScore's QML plugin framework (NOT VST/audio plugins) regression Regression on a prior release

Comments

@TrebledJ
Copy link

TrebledJ commented Sep 8, 2023

Issue type

Crash or freeze

Bug description

Greetings! When opening a plugin containing a TextField component, the MS app crashes. Replacing the TextField component with TextInput or simply removing it, seems to fix the issue.

Steps to reproduce

  1. Open MS.
  2. Enable Tuning/Modal Tuning/Modal Temperaments.
  3. Open a score.
  4. Open any of the above plugins.
  5. Witness the amazing crash!

You can also use this plugin to test:

import QtQuick 2.0
import MuseScore 3.0
import QtQuick.Controls 1.0

MuseScore {
    id: plugin
    description: "This is a description."
    version: "4.0.0"
    
    title: qsTr("Test")

    pluginType: "dialog"
    requiresScore: false

    width: 100
    height: 100

    TextField {
        text: "Hi"
    }
}

Screenshots/Screen recordings

No response

MuseScore Version

4.1.1

Regression

Yes, this used to work in MuseScore 3.x and now is broken

Operating system

macOS 12.6.8

Additional context

I have reason to suspect this issue also occurs with macOS 13 Ventura. Also MS 4.1.1.


Logs for Modal-Temperaments plugin with TextField.

15:17:17.359 | INFO  | main_thread | ActionsDispatcher | dispatch: try call action: Temperaments
[1142:19200:20230908,151717.689109:ERROR directory_reader_posix.cc:42] opendir /Users/redacted/Library/Application Support/MuseScore/MuseScore4/logs/dumps/attachments/97161e87-d102-4f0e-b18f-fdd867ac15a0: No such file or directory (2)
[1142:19197:20230908,151717.689109:WARNING crash_report_exception_handler.cc:254] UniversalExceptionRaise: (os/kern) failure (5)
zsh: segmentation fault  /Applications/MuseScore\ 4.app/Contents/MacOS/mscore

Sometimes the order of the middle two lines are reversed:

15:17:17.359 | INFO  | main_thread | ActionsDispatcher | dispatch: try call action: Temperaments
[1421:25941:20230908,152932.797494:WARNING crash_report_exception_handler.cc:254] UniversalExceptionRaise: (os/kern) failure (5)
[1421:25942:20230908,152932.798054:ERROR directory_reader_posix.cc:42] opendir /Users/redacted/Library/Application Support/MuseScore/MuseScore4/logs/dumps/attachments/653c9cf5-6a23-43f2-9c7d-b7838f828ec3: No such file or directory (2)
zsh: segmentation fault  /Applications/MuseScore\ 4.app/Contents/MacOS/mscore

Similar messages even with the debug flag enabled (-d).

On checking the /Users/redacted/Library/Application Support/MuseScore/MuseScore4/logs/dumps/attachments/ folder, no files could be found.

@muse-bot muse-bot added crash Issues involving a crash of MuseScore regression_ms3 Regression from MS3 (3.6.2) labels Sep 8, 2023
@cbjeukendrup cbjeukendrup added the plugins Related to MuseScore's QML plugin framework (NOT VST/audio plugins) label Sep 8, 2023
@bkunda bkunda added the P1 Priority: High label Sep 8, 2023
@zacjansheski zacjansheski added regression Regression on a prior release and removed regression_ms3 Regression from MS3 (3.6.2) labels Sep 8, 2023
@zacjansheski
Copy link
Contributor

The plug-ins do not crash in 4.0, crash first appeared in 4.1

@Jojo-Schmitz
Copy link
Contributor

Seems the bug doesn't reproduce on Windows 11

@cbjeukendrup
Copy link
Contributor

The crash seems to happen deep inside Qt.

As a workaround (or better solution anyway), you can use TextEdit from QtQuick.Controls 2.15.

A possible cause of the crash might be the switch to Qt 5.15.9. That has happened only on macOS, and indeed between 4.0.2 and 4.1.0.

Since QtQuick.Controls 1.0 is deprecated by Qt anyway, I don't know if this should be a top priority.

@bkunda bkunda added the community Issues we would like the community to address label Sep 22, 2023
@TrebledJ
Copy link
Author

One issue with QtQuick.Controls 2.15 is the UI. With Controls 1.0, the MuseScore look-and-feel is inherited. But with 2.0+, it reverts to the native style, at least on macOS. I believe this is why many plugins still use QtQuick Controls 1.0: the code is simple and the UI looks good by default, thanks to MS controls.

If there was a way to keep the MuseScore style (either by importing a MuseScore controls folder or using delegates), then I'm all for switching to Controls 2.0+. But currently documentation about this (within MS) is lacking.

@cbjeukendrup
Copy link
Contributor

You can import MuseScore's own controls using import MuseScore.UiComponents 1.0 (and for some things you also need import MuseScore.Ui 1.0).
This gives access to the real components used in MuseScore's own UI. The components from QtQuick.Controls 1.0 are actually emulating QWidgets, and MuseScore 4 contains some special styling code to make QWidgets look a bit like MuseScore's QML style.
However, note that most of MuseScore's own components are custom, and have not exactly the same API and behaviour as those from Qt. So, the Qt documentation is not going to be helpful for them. There is no real documentation either; the best thing you can do is just look how these components are used in MuseScore itself. That might be a difficulty.

@TrebledJ
Copy link
Author

Ah cool, thanks for the pointers. I'll play around with MuseScore's QML components then.

@Jojo-Schmitz
Copy link
Contributor

Is QtQuick.Controls 2.2 save too? 2.15 is not available for Mu3 (Qt 5.9), so that'd otherwise break the dual compatibility plugins

@cbjeukendrup
Copy link
Contributor

Yes, the differences between different 2.x versions should not be too big

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues we would like the community to address crash Issues involving a crash of MuseScore P1 Priority: High plugins Related to MuseScore's QML plugin framework (NOT VST/audio plugins) regression Regression on a prior release
Projects
Status: Available
Development

Successfully merging a pull request may close this issue.

7 participants