mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
DolphinQt: Properly Delete (Some) Widgets
This is not every memory leak, just the ones that were obvious.
This commit is contained in:
@ -806,6 +806,8 @@ void BranchWatchDialog::OnTableContextMenu(const QPoint& pos)
|
||||
QModelIndexList index_list = m_table_view->selectionModel()->selectedRows(index.column());
|
||||
|
||||
QMenu* const menu = new QMenu;
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
menu->addAction(tr("&Delete"), [this, index_list]() { OnTableDelete(std::move(index_list)); });
|
||||
switch (index.column())
|
||||
{
|
||||
|
@ -309,6 +309,7 @@ void BreakpointWidget::OnClear()
|
||||
void BreakpointWidget::OnNewBreakpoint()
|
||||
{
|
||||
BreakpointDialog* dialog = new BreakpointDialog(this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
SetQWidgetWindowDecorations(dialog);
|
||||
dialog->exec();
|
||||
}
|
||||
@ -319,6 +320,7 @@ void BreakpointWidget::OnEditBreakpoint(u32 address, bool is_instruction_bp)
|
||||
{
|
||||
auto* dialog =
|
||||
new BreakpointDialog(this, m_system.GetPowerPC().GetBreakPoints().GetBreakpoint(address));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
SetQWidgetWindowDecorations(dialog);
|
||||
dialog->exec();
|
||||
}
|
||||
@ -326,6 +328,7 @@ void BreakpointWidget::OnEditBreakpoint(u32 address, bool is_instruction_bp)
|
||||
{
|
||||
auto* dialog =
|
||||
new BreakpointDialog(this, m_system.GetPowerPC().GetMemChecks().GetMemCheck(address));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
SetQWidgetWindowDecorations(dialog);
|
||||
dialog->exec();
|
||||
}
|
||||
@ -387,6 +390,7 @@ void BreakpointWidget::OnContextMenu()
|
||||
const auto is_memory_breakpoint = selected_item->data(IS_MEMCHECK_ROLE).toBool();
|
||||
|
||||
auto* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
if (!is_memory_breakpoint)
|
||||
{
|
||||
|
@ -558,6 +558,7 @@ void CodeViewWidget::ReplaceAddress(u32 address, ReplaceWith replace)
|
||||
void CodeViewWidget::OnContextMenu()
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
const bool running = Core::GetState(m_system) != Core::State::Uninitialized;
|
||||
const bool paused = Core::GetState(m_system) == Core::State::Paused;
|
||||
|
@ -873,6 +873,7 @@ void MemoryViewWidget::OnContextMenu(const QPoint& pos)
|
||||
->IsValidAddress(Core::CPUThreadGuard{m_system}, addr);
|
||||
|
||||
auto* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
menu->addAction(tr("Copy Address"), this, [this, addr] { OnCopyAddress(addr); });
|
||||
|
||||
|
@ -118,6 +118,7 @@ void RegisterWidget::OnItemChanged(QTableWidgetItem* item)
|
||||
void RegisterWidget::ShowContextMenu()
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
auto* raw_item = m_table->currentItem();
|
||||
|
||||
|
@ -119,6 +119,8 @@ void ThreadWidget::ShowContextMenu(QTableWidget* table)
|
||||
return;
|
||||
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
const QString watch_name = QStringLiteral("thread_context_%1").arg(addr, 8, 16, QLatin1Char('0'));
|
||||
menu->addAction(tr("Add &breakpoint"), this, [this, addr] { emit RequestBreakpoint(addr); });
|
||||
menu->addAction(tr("Add memory breakpoint"), this,
|
||||
|
@ -327,6 +327,7 @@ void WatchWidget::OnSave()
|
||||
void WatchWidget::ShowContextMenu()
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
if (!m_table->selectedItems().empty())
|
||||
{
|
||||
|
Reference in New Issue
Block a user