Crash on startup with Qt 5.14
Yes, I know that officially Qt 5.14 is not supported, but some distros are moving on to it as default. With this Qt version MuseScore crashes on startup (after the splash screen is displayed) with the following assert and backtrace:
ASSERT: "!d->isWidget" in file qtcore-5.14.9999/src/corelib/kernel/qobject.cpp, line 2109
#0 ff4de93a4 in raise () from /lib64/libc.so.6
#1 0x00007ffff4dd2536 in abort () from /lib64/libc.so.6
#2 0x00007ffff53f850d in qt_message_fatal (context=..., message=...)
at qtcore-5.14.9999/src/corelib/global/qlogging.cpp:1894
#3 QMessageLogger::fatal (this=this@entry=0x7fffffffcd90,
msg=msg@entry=0x7ffff56e74e8 "ASSERT: \"%s\" in file %s, line %d")
at qtcore-5.14.9999/src/corelib/global/qlogging.cpp:893
#4 0x00007ffff53f7405 in qt_assert (assertion=assertion@entry=0x7ffff57dc6b8 "!d->isWidget",
file=file@entry=0x7ffff57db4f8 "qtcore-5.14.9999/src/corelib/kernel/qobject.cpp", line=line@entry=2109)
at qtcore-5.14.9999/src/corelib/global/qlogging.h:90
#5 0x00007ffff5417a94 in QObject::setParent (this=, parent=)
at qtcore-5.14.9999/src/corelib/kernel/qobject.cpp:2106
#6 QObject::setParent (this=, parent=)
at qtcore-5.14.9999/src/corelib/kernel/qobject.cpp:2106
#7 0x0000555555cbfdbd in Ms::Workspace::readGlobalMenuBar (this=0x55555780f250)
at MuseScore-3.3.4/mscore/workspace.cpp:932
#8 0x0000555555cc15f0 in Ms::Workspace::read (this=0x55555780f250, e=...)
at MuseScore-3.3.4/mscore/workspace.cpp:877
#9 0x0000555555cbc6c4 in std::function::operator()(Ms::XmlReader&) const (
__args#0=..., this=0x7fffffffd2f0)
at /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9/bits/std_function.h:685
#10 Ms::WorkspacesManager::readWorkspaceFile(QString const&, std::function)
(path=..., readWorkspace=...)
at MuseScore-3.3.4/mscore/workspace.cpp:661
#11 0x0000555555cc0f40 in Ms::Workspace::read (this=0x55555780f250)
at /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9/new:174
#12 0x0000555555cc3cab in Ms::MuseScore::changeWorkspace (this=0x555558583070, p=0x55555780f250,
first=first@entry=true)
at MuseScore-3.3.4/mscore/workspace.cpp:223
#13 0x00005555558ee4b2 in main (argc=, av=)
at MuseScore-3.3.4/mscore/musescore.cpp:7760
System: Gentoo Linux 64-bit
Portage installed Qt version 5.14
GCC version 9.2.0 (Gentoo 9.2.0-r3 p4)
Comments
Not sure whether my earlier comment got accepted because of embedded URLs.
The problem seems to be that QObject::setParent() (which is not virtual) asserts if called for an object that is actually a QWidget. The attached patch fixes this by ensuring that QWidget::setParent() is called instead for the QMenu. There are two places where this happens, but only the call in Workspace::readGlobalMenuBar() appears to crash.
Hmm, I built MuseScore with a Qt 5.15.0 snapshot yesterday, no crash
Anyway, mind to submit a PR fot this on GitHub?
In reply to Hmm, I built MuseScore with… by Jojo-Schmitz
Thanks for testing Qt 5.15. Is the Qt snapshot built in debug mode? - not all of the asserts are enabled in release mode.
No, good point, it is an MSVC build RelWithDebInfo
See https://github.com/musescore/MuseScore/pull/5624
Hey, jmarten.
What exactly the reason of crash?
And why QMenuBar::clear() isn't enough? Did you tested it without 827 and 828?
Please, move local variable from the if condition.
Please, move local variable from the if condition.
Done
Fixed in branch master, commit 28a4803791
_fix #299654: Crash on startup with Qt 5.14
due to a failed assertion deep in Qt code_
Fixed in branch master, commit d60881e88f
_Merge pull request #5624 from Jojo-Schmitz/qt-5.14-crash
fix #299654: Crash on startup with Qt 5.14_
Automatically closed -- issue fixed for 2 weeks with no activity.