From 0d6297fef0985198fde87baa772f309087572305 Mon Sep 17 00:00:00 2001 From: Danila Malyutin Date: Sat, 5 Dec 2015 19:40:30 +0300 Subject: [PATCH] GUI: Fix wx assert on first right-click in game list Don't know why it was working before. Anyway, it seems ugly and it probably should be handled differently (the whole function, or whole GUI ;P). --- rpcs3/Gui/GameViewer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index f86d70c4db..30101ab31b 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -49,7 +49,6 @@ GameViewer::GameViewer(wxWindow* parent) : wxListView(parent) m_sortAscending = true; m_path = "/dev_hdd0/game/"; m_popup = new wxMenu(); - m_popup->Append(0, _T("Remove Game")); Bind(wxEVT_LIST_ITEM_ACTIVATED, &GameViewer::DClick, this); Bind(wxEVT_LIST_COL_CLICK, &GameViewer::OnColClick, this); @@ -227,9 +226,9 @@ void GameViewer::DClick(wxListEvent& event) void GameViewer::RightClick(wxListEvent& event) { - m_popup->Destroy(0); - m_popup->Destroy(1); - m_popup->Destroy(2); + for (wxMenuItem *item : m_popup->GetMenuItems()) { + m_popup->Destroy(item); + } wxMenuItem* boot_item = new wxMenuItem(m_popup, 0, _T("Boot")); #if defined (_WIN32)