Debugger: Prevent crashing opportunities when there is an empty function list

This commit is contained in:
Ty Lamontagne 2023-10-26 18:35:11 -04:00 committed by refractionpcsx2
parent 46a0c2d5b6
commit ebe6d3cbee
1 changed files with 30 additions and 28 deletions

View File

@ -612,6 +612,8 @@ void CpuWidget::onFuncListContextMenu(QPoint pos)
else
m_funclistContextMenu->clear();
if (m_ui.listFunctions->selectedItems().count() && m_ui.listFunctions->selectedItems().first()->data(256).isValid())
{
QAction* copyName = new QAction(tr("Copy Function Name"), m_ui.listFunctions);
connect(copyName, &QAction::triggered, [this] {
// We only store the address in the widget item
@ -645,10 +647,10 @@ void CpuWidget::onFuncListContextMenu(QPoint pos)
m_ui.memoryviewWidget->gotoAddress(m_ui.listFunctions->selectedItems().first()->data(256).toUInt());
});
m_funclistContextMenu->addSeparator();
m_funclistContextMenu->addAction(gotoMemory);
m_funclistContextMenu->addSeparator();
}
//: "Demangling" is the opposite of "Name mangling", which is a process where a compiler takes function names and combines them with other characteristics of the function (e.g. what types of data it accepts) to ensure they stay unique even when multiple functions exist with the same name (but different inputs / const-ness). See here: https://en.wikipedia.org/wiki/Name_mangling#C++
QAction* demangleAction = new QAction(tr("Demangle Symbols"), m_ui.listFunctions);
demangleAction->setCheckable(true);