Origin: upstream, commit:28a48037911f25981e252b03dce65ba2ed0a49e6
Author: Joachim Schmitz <jojo@schmitz-digital.de>
Description: fix #299654: Crash on startup with Qt 5.14
 due to a failed assertion deep in Qt code

--- a/mscore/workspace.cpp
+++ b/mscore/workspace.cpp
@@ -707,9 +707,10 @@ void Workspace::read(XmlReader& e)
                   QMenuBar* mb = mscore->menuBar();
                   const QObjectList menus(mb->children()); // need a copy
                   for (QObject* m : menus) {
-                        if (qobject_cast<QMenu*>(m)) {
-                              m->setParent(nullptr);
-                              m->deleteLater();
+                        QMenu* menu = qobject_cast<QMenu*>(m);
+                        if (menu) {
+                              menu->setParent(nullptr);
+                              menu->deleteLater();
                               }
                         }
                   mb->clear();
@@ -813,9 +814,10 @@ void Workspace::readGlobalMenuBar()
                               QMenuBar* mb = mscore->menuBar();
                               const QObjectList menus(mb->children()); // need a copy
                               for (QObject* m : menus) {
-                                    if (qobject_cast<QMenu*>(m)) {
-                                          m->setParent(nullptr);
-                                          m->deleteLater();
+                                    QMenu* menu = qobject_cast<QMenu*>(m);
+                                    if (menu) {
+                                          menu->setParent(nullptr);
+                                          menu->deleteLater();
                                           }
                                     }
                               mb->clear();
