From adcfefecde2d3583e2df539c04d1a85e8dfe7821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 19 Dec 2016 10:41:40 +0100 Subject: [PATCH] DolphinWX: Fix booting from DVD OnBootDrive used the "drives" member std::vector for drive paths, but since PR #4363, this vector is not populated anymore, so we were accessing it out of bounds. Actually, drives was not needed in the first place, since we can get the wxMenu from the event, and from there, get the label directly. --- Source/Core/DolphinWX/Frame.cpp | 2 -- Source/Core/DolphinWX/Frame.h | 2 -- Source/Core/DolphinWX/FrameTools.cpp | 3 ++- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 7edf138606..e4bd51fccc 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -468,8 +468,6 @@ CFrame::~CFrame() HotkeyManagerEmu::Shutdown(); g_controller_interface.Shutdown(); - drives.clear(); - #if defined(HAVE_XRANDR) && HAVE_XRANDR delete m_XRRConfig; #endif diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index dc31fed7cd..805dea8967 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -162,8 +162,6 @@ private: bool m_tried_graceful_shutdown = false; int m_saveSlot = 1; - std::vector drives; - enum { ADD_PANE_TOP, diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 81db8f6d40..e50403f6fa 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -733,7 +733,8 @@ void CFrame::StartGame(const std::string& filename) void CFrame::OnBootDrive(wxCommandEvent& event) { - BootGame(drives[event.GetId() - IDM_DRIVE1]); + const auto* menu = static_cast(event.GetEventObject()); + BootGame(WxStrToStr(menu->GetLabelText(event.GetId()))); } void CFrame::OnRefresh(wxCommandEvent& WXUNUSED(event))