summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLPFaint99 <lpfaint99@gmail.com>2009-08-12 05:57:59 +0000
committerLPFaint99 <lpfaint99@gmail.com>2009-08-12 05:57:59 +0000
commitb4faea0186f464a7c6e240647d2c98bcd5a597f2 (patch)
treead5529da2f6a085df1273755482010ad630a1442 /Source/Core
parent70f5d17d43edaf0526f51ff622029aa3b1353c28 (diff)
fix changedisc (broken by switch to unicode)
char * was deallocated before callback was reached, How did it work before XTra.KrazzY? git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3969 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/HW/DVDInterface.cpp22
-rw-r--r--Source/Core/DolphinWX/Src/FrameTools.cpp7
2 files changed, 19 insertions, 10 deletions
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