[Amis-vcs] SF.net SVN: amis: [2419] branches/amis3/AmisGuiMFC2
Brought to you by:
julienq,
marisademeglio
From: <dan...@us...> - 2008-03-17 22:53:58
|
Revision: 2419 http://amis.svn.sourceforge.net/amis/?rev=2419&view=rev Author: daniel_weck Date: 2008-03-17 15:54:01 -0700 (Mon, 17 Mar 2008) Log Message: ----------- fixed the weird kernel32.dll crash that happened in debugging mode (with untraceable assembly code), when closing the app after a self-voiced dialog was shown. Calling Stop() from the MFC event dispatch thread eradicated the problem...dunno why but it works. Modified Paths: -------------- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp Modified: branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h =================================================================== --- branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/include/gui/MainFrm.h 2008-03-17 22:54:01 UTC (rev 2419) @@ -84,6 +84,7 @@ afx_msg void OnUpdateCmdUiBiggerFont(CCmdUI*); afx_msg void OnUpdateCmdUiSmallerFont(CCmdUI*); afx_msg void OnUpdateCmdUiBookmarks(CCmdUI*); + afx_msg void OnClose(); DECLARE_MESSAGE_MAP() public: void updateToolbarState(toolbar::Toolbar*); Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -72,7 +72,7 @@ #if _DEBUG //get Visual Leak Detector version 1.0 here: http://dmoulding.googlepages.com/downloads -#include <vld.h> +//#include <vld.h> #endif using namespace amis::gui; @@ -865,27 +865,22 @@ //AudioSequencePlayer::Instance()->Stop(); AudioSequencePlayer::playPromptFromStringId("dialogClosed"); - if (b_was_playing == true) - { - - AudioSequencePlayer::Instance()->WaitForEndSeqAndRestartBook(); - - } + if (b_was_playing == true) + { + AudioSequencePlayer::Instance()->WaitForEndSeqAndRestartBook(); + } - } else { - //resume playback - if (b_was_playing == true) - { - - //MainWndParts::Instance()->mpMainFrame->PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); - - MmView *view = MainWndParts::Instance()->mpMmView; - view->OnFilePlay(); + //resume playback + if (b_was_playing == true) + { + //MainWndParts::Instance()->mpMainFrame->PostMessage(WM_COMMAND, ID_AMBULANT_PLAY); + MmView *view = MainWndParts::Instance()->mpMmView; + view->OnFilePlay(); + } } - } } void CAmisApp::generalBookErrorMsgBox(CString str) Modified: branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/MainFrm.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -50,7 +50,8 @@ IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) - //{{AFX_MSG_MAP(CMainFrame) + //{{AFX_MSG_MAP(CMainFrame) + ON_WM_CLOSE() ON_WM_CREATE() //ON_MESSAGE(WM_MESSAGETOAMIS, OnMessageFromPlugin) ON_WM_INITMENUPOPUP() @@ -122,6 +123,13 @@ delete mCommonPreTranslateMessageHandler; delete mMenuVoicing; } + +void CMainFrame::OnClose() +{ + // That is a hack to remove a weird bug (crash after ExitInstance() when a self-voicing dialog was previously open) + AudioSequencePlayer::Instance()->Stop(); + CMDIFrameWnd::OnClose(); +} BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { if (amis::Preferences::Instance()->getIsSelfVoicing() == true) @@ -368,7 +376,7 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { - if (pMsg->message == WM_KEYUP) + if (pMsg->message == WM_KEYUP) { CWnd* cwnd = this->GetFocus(); if (pMsg->wParam == VK_ESCAPE) { Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -508,7 +508,6 @@ if (m_previousAudioSequence) { Play(m_previousAudioSequence); } - } //unsigned __stdcall eventHandler(void* lpParam) { @@ -535,7 +534,7 @@ HANDLE xeventHandler = CreateThread(NULL, 0, &eventHandlerY, 0, 0, &lpdwThreadID); //AfxBeginThread(eventHandlerX,0); //GetCurrentThreadId - TRACE("\nTHREAD ID (AUDIO_SEQ_PLAYER): %x\n", lpdwThreadID); + TRACE("\nTHREAD ID (WaitForEndSeqAndRestartBook): %x\n", lpdwThreadID); } void AudioSequencePlayer::Stop(bool fromPlay) Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 20:50:49 UTC (rev 2418) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/PreTranslateMessageHandler.cpp 2008-03-17 22:54:01 UTC (rev 2419) @@ -254,6 +254,7 @@ if (mbKeyControl && wasSameKey) { //if (seq != NULL && !(seq->IsEmpty()) && playNow) AudioSequencePlayer::Instance()->Play(seq, true); //else AudioSequencePlayer::Instance()->Stop(); + TRACE(L"\n @@@ CONTROL KEY STOP\n"); AudioSequencePlayer::Instance()->Stop(); } mbKeyControl = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |