Fix crash when opening theme editing window. (#2050)

This commit is contained in:
karliss 2020-02-04 11:02:34 +02:00 committed by GitHub
parent 37544b45d5
commit 5af4dce7f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -156,8 +156,10 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent, MainWindow *main
addSeparator();
pluginMenu = mainWindow->getContextMenuExtensions(MainWindow::ContextMenuType::Disassembly);
pluginActionMenuAction = addMenu(pluginMenu);
if (mainWindow) {
pluginMenu = mainWindow->getContextMenuExtensions(MainWindow::ContextMenuType::Disassembly);
pluginActionMenuAction = addMenu(pluginMenu);
}
addSeparator();
@ -529,9 +531,11 @@ void DisassemblyContextMenu::aboutToShowSlot()
QString progCounterName = Core()->getRegisterName("PC").toUpper();
actionSetPC.setText("Set " + progCounterName + " here");
pluginActionMenuAction->setVisible(!pluginMenu->isEmpty());
for (QAction *pluginAction : pluginMenu->actions()) {
pluginAction->setData(QVariant::fromValue(offset));
if (pluginMenu) {
pluginActionMenuAction->setVisible(!pluginMenu->isEmpty());
for (QAction *pluginAction : pluginMenu->actions()) {
pluginAction->setData(QVariant::fromValue(offset));
}
}
}

View File

@ -163,8 +163,6 @@ private:
QAction actionAddBreakpoint;
QAction actionAdvancedBreakpoint;
QMenu *pluginMenu;
QAction actionSetToCode;
QAction actionSetAsStringAuto;
@ -182,7 +180,8 @@ private:
QAction showInSubmenu;
QList<QAction*> showTargetMenuActions;
QAction *pluginActionMenuAction;
QMenu *pluginMenu = nullptr;
QAction *pluginActionMenuAction = nullptr;
// For creating anonymous entries (that are always visible)
QAction *addAnonymousAction(QString name, const char *slot, QKeySequence shortcut);