diff --git a/Source/Core/Core/Src/HW/DVDInterface.cpp b/Source/Core/Core/Src/HW/DVDInterface.cpp index 6e78694354..5d2a1252e9 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.cpp +++ b/Source/Core/Core/Src/HW/DVDInterface.cpp @@ -301,6 +301,8 @@ bool IsDiscInside() // Take care of all logic of "swapping discs" // We want this in the "backend", NOT the gui +// any !empty string will be deleted to ensure +// that the userdata string exists when called void ChangeDiscCallback(u64 userdata, int cyclesLate) { std::string FileName((const char*)userdata); @@ -314,17 +316,21 @@ void ChangeDiscCallback(u64 userdata, int cyclesLate) // Empty the drive VolumeHandler::EjectVolume(); } - else if (VolumeHandler::SetVolumeName(FileName)) - { - // Save the new ISO file name - SavedFileName = FileName; - } else { - PanicAlert("Invalid file"); + delete [] (char *) userdata; + if (VolumeHandler::SetVolumeName(FileName)) + { + // Save the new ISO file name + SavedFileName = FileName; + } + else + { + PanicAlert("Invalid file \n %s", FileName.c_str()); - // Put back the old one - VolumeHandler::SetVolumeName(SavedFileName); + // Put back the old one + VolumeHandler::SetVolumeName(SavedFileName); + } } SetLidOpen(false); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index ec2c74aeae..ea62484595 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -474,7 +474,10 @@ void CFrame::DoOpen(bool Boot) { if (!fileChosen) path = wxT(""); - DVDInterface::ChangeDisc((const char *)path.mb_str()); + // temp is deleted by changediscCallback + char * temp = new char[strlen(path.mb_str())]; + strncpy(temp, path.mb_str(), strlen(path.mb_str())); + DVDInterface::ChangeDisc(temp); } } @@ -631,7 +634,7 @@ void CFrame::OnShow_InfoWindow(wxCommandEvent& WXUNUSED (event)) void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event)) { - BootManager::BootCore(FULL_WII_MENU_DIR); + BootManager::BootCore(FULL_WII_MENU_DIR); } // Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover