optional-qtwebengine-14-5006d4f9ed636ad0798af9dac01a91bdff877d45
authorDebian Multimedia Maintainers <debian-multimedia@lists.debian.org>
Sat, 29 Jun 2019 01:02:25 +0000 (02:02 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Sat, 29 Jun 2019 01:02:25 +0000 (02:02 +0100)
commit 5006d4f9ed636ad0798af9dac01a91bdff877d45
Author: Nathan Ho <nathan@snappizz.com>
Date:   Thu Jul 4 19:56:05 2019 -0700

    scide: Fix crashes for certain menu items and actions with QtWebEngine off

Gbp-Pq: Name optional-qtwebengine-14-5006d4f9ed636ad0798af9dac01a91bdff877d45

editors/sc-ide/widgets/lookup_dialog.cpp
editors/sc-ide/widgets/main_window.cpp
editors/sc-ide/widgets/main_window.hpp

index a199e4d997cf5638c6447f1fb1b473136ddf4c28..d74410b4abcb69f40ec7c7ac4a1bc7cf0ddff16a 100644 (file)
@@ -36,7 +36,9 @@
 namespace ScIDE {
 
 GenericLookupDialog::GenericLookupDialog(QWidget* parent): QDialog(parent) {
+#ifdef SC_USE_QTWEBENGINE
     addAction(MainWindow::instance()->action(MainWindow::LookupDocumentationForCursor));
+#endif // SC_USE_WEBENGINE
 
     mQueryEdit = new QLineEdit(this);
 
index ae707c1c27bc5c293a3be86313a32cd933fe89ba..9b471d7718d5ea87d77ecdf6ad633b0fcce7a753 100644 (file)
@@ -441,21 +441,20 @@ void MainWindow::createActions()
     settings->addAction(action, "ide-settings-dialog", ideCategory);
 
     // Help
+    mActions[ReportABug] = action = new QAction(QIcon::fromTheme("system-help"), tr("Report a bug..."), this);
+    action->setStatusTip(tr("Report a bug"));
+    connect(action, SIGNAL(triggered()), this, SLOT(doBugReport()));
+
+#ifdef SC_USE_QTWEBENGINE
     mActions[Help] = action = new QAction(tr("Show &Help Browser"), this);
     action->setStatusTip(tr("Show and focus the Help Browser"));
     connect(action, SIGNAL(triggered()), this, SLOT(openHelp()));
     settings->addAction(action, "help-browser", helpCategory);
 
-#ifdef SC_USE_QTWEBENGINE
     mActions[HelpAboutIDE] = action =
         new QAction(QIcon::fromTheme("system-help"), tr("How to Use SuperCollider IDE"), this);
     action->setStatusTip(tr("Open the SuperCollider IDE guide"));
     connect(action, SIGNAL(triggered()), this, SLOT(openHelpAboutIDE()));
-#endif // SC_USE_QTWEBENGINE
-
-    mActions[ReportABug] = action = new QAction(QIcon::fromTheme("system-help"), tr("Report a bug..."), this);
-    action->setStatusTip(tr("Report a bug"));
-    connect(action, SIGNAL(triggered()), this, SLOT(doBugReport()));
 
     mActions[LookupDocumentationForCursor] = action = new QAction(tr("Look Up Documentation for Cursor"), this);
     action->setShortcut(tr("Ctrl+D", "Look Up Documentation for Cursor"));
@@ -468,6 +467,7 @@ void MainWindow::createActions()
     action->setStatusTip(tr("Enter text to look up in documentation"));
     connect(action, SIGNAL(triggered()), this, SLOT(lookupDocumentation()));
     settings->addAction(action, "help-lookup", helpCategory);
+#endif // SC_USE_QTWEBENGINE
 
     mActions[ShowAbout] = action = new QAction(QIcon::fromTheme("help-about"), tr("&About SuperCollider"), this);
     connect(action, SIGNAL(triggered()), this, SLOT(showAbout()));
@@ -503,8 +503,10 @@ void MainWindow::createActions()
 
     // Add actions to docklets, so shortcuts work when docklets detached:
 
+#ifdef SC_USE_QTWEBENGINE
     mPostDocklet->widget()->addAction(mActions[LookupDocumentation]);
     mPostDocklet->widget()->addAction(mActions[LookupDocumentationForCursor]);
+#endif // SC_USE_QTWEBENGINE
     mPostDocklet->widget()->addAction(mActions[LookupImplementation]);
     mPostDocklet->widget()->addAction(mActions[LookupImplementationForCursor]);
     mPostDocklet->widget()->addAction(mActions[LookupReferences]);
@@ -672,7 +674,9 @@ void MainWindow::createMenus() {
     menuBar->addMenu(menu);
 
     menu = new QMenu(tr("&Help"), this);
+#ifdef SC_USE_QTWEBENGINE
     menu->addAction(mActions[HelpAboutIDE]);
+#endif
     menu->addAction(mActions[ReportABug]);
 #ifdef SC_USE_QTWEBENGINE
     menu->addSeparator();
index 7c9b82840faf175e4d148d82f088e1d3329cbab9..d8fb6af0fbf4386f5eca5834e54bc2ccd293ca46 100644 (file)
@@ -101,8 +101,15 @@ public:
         Help,
         HelpAboutIDE,
         ReportABug,
+
+#ifdef SC_USE_QTWEBENGINE
+        // These QtWebEngine-only actions are branched at the preprocessor
+        // level so that accidental invocations of these actions in other code
+        // are caught at compile time.
         LookupDocumentationForCursor,
         LookupDocumentation,
+#endif // SC_USE_QTWEBENGINE
+
         ShowAbout,
         ShowAboutQT,