Fix crash in memory viewer launcher (#17152)

This commit is contained in:
Elad 2025-05-03 18:34:42 +03:00 committed by GitHub
parent 75b728be7e
commit cf1e53f9c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -22,7 +22,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C
: QDialog(parent)
, m_pc(_pc)
, m_disasm(_disasm->copy_type_erased())
, m_get_cpu(std::move(func))
, m_get_cpu(func ? std::move(func) : std::function<cpu_thread*()>(FN(nullptr)))
{
setWindowTitle(tr("Edit instruction"));
setAttribute(Qt::WA_DeleteOnClose);

View file

@ -35,7 +35,7 @@ constexpr auto qstr = QString::fromStdString;
memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr<CPUDisAsm> disasm, u32 addr, std::function<cpu_thread*()> func)
: QDialog(parent)
, m_addr(addr)
, m_get_cpu(std::move(func))
, m_get_cpu(func ? std::move(func) : std::function<cpu_thread*()>(FN(nullptr)))
, m_type([&]()
{
const auto cpu = m_get_cpu();

View file

@ -62,7 +62,7 @@ enum registers : int
register_editor_dialog::register_editor_dialog(QWidget *parent, CPUDisAsm* _disasm, std::function<cpu_thread*()> func)
: QDialog(parent)
, m_disasm(_disasm)
, m_get_cpu(std::move(func))
, m_get_cpu(func ? std::move(func) : std::function<cpu_thread*()>(FN(nullptr)))
{
setWindowTitle(tr("Edit registers"));
setAttribute(Qt::WA_DeleteOnClose);