From: <sag...@us...> - 2014-03-02 12:18:15
|
Revision: 3808 http://sourceforge.net/p/modplug/code/3808 Author: saga-games Date: 2014-03-02 12:18:09 +0000 (Sun, 02 Mar 2014) Log Message: ----------- [Fix] Don't crash in 64-bit builds when MIDI record is auto-enabled on startup but there's no MIDI device (crashed when the options dialog was supposed to be brought up, which we don't actually want on startup anyway) Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mpt_midi.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-02 10:19:02 UTC (rev 3807) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-02 12:18:09 UTC (rev 3808) @@ -356,7 +356,7 @@ UpdateColors(); - if(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_MIDIRECORD) OnMidiRecord(); + if(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_MIDIRECORD) midiOpenDevice(false); return 0; } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-02 10:19:02 UTC (rev 3807) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-02 12:18:09 UTC (rev 3808) @@ -369,7 +369,7 @@ // Midi Input Functions public: - BOOL midiOpenDevice(); + bool midiOpenDevice(bool showSettings = true); void midiCloseDevice(); void midiReceive(); void SetMidiRecordWnd(HWND hwnd) { m_hWndMidi = hwnd; } Modified: trunk/OpenMPT/mptrack/Mpt_midi.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpt_midi.cpp 2014-03-02 10:19:02 UTC (rev 3807) +++ trunk/OpenMPT/mptrack/Mpt_midi.cpp 2014-03-02 12:18:09 UTC (rev 3808) @@ -111,28 +111,31 @@ } -BOOL CMainFrame::midiOpenDevice() -//------------------------------- +bool CMainFrame::midiOpenDevice(bool showSettings) +//------------------------------------------------ { - if (shMidiIn) return TRUE; + if (shMidiIn) return true; if (midiInOpen(&shMidiIn, TrackerSettings::Instance().m_nMidiDevice, (DWORD_PTR)MidiInCallBack, 0, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { shMidiIn = NULL; // Show MIDI configuration on fail. - CMainFrame::m_nLastOptionsPage = OPTIONS_PAGE_MIDI; - CMainFrame::GetMainFrame()->OnViewOptions(); + if(showSettings) + { + CMainFrame::m_nLastOptionsPage = OPTIONS_PAGE_MIDI; + CMainFrame::GetMainFrame()->OnViewOptions(); + } // Let's see if the user updated the settings. if(midiInOpen(&shMidiIn, TrackerSettings::Instance().m_nMidiDevice, (DWORD_PTR)MidiInCallBack, 0, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { shMidiIn = NULL; - return FALSE; + return false; } } midiInStart(shMidiIn); - return TRUE; + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |