[Amis-vcs] SF.net SVN: amis: [2364] branches/amis3
Brought to you by:
julienq,
marisademeglio
From: <dan...@us...> - 2008-03-02 12:17:56
|
Revision: 2364 http://amis.svn.sourceforge.net/amis/?rev=2364&view=rev Author: daniel_weck Date: 2008-03-02 04:18:00 -0800 (Sun, 02 Mar 2008) Log Message: ----------- - fixed a major bug in the destructor code of Prompt (was not iterating properly over its members). - fixed another major de-allocation bug: mnemonic and shortcut members were not destroyed There are still leaks, presumably from promptItemRefs...I'm working on it. Modified Paths: -------------- branches/amis3/AmisAudio/include/AmisAudio.h branches/amis3/AmisCore/include/Media.h branches/amis3/AmisCore/src/Media.cpp branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp Modified: branches/amis3/AmisAudio/include/AmisAudio.h =================================================================== --- branches/amis3/AmisAudio/include/AmisAudio.h 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisAudio/include/AmisAudio.h 2008-03-02 12:18:00 UTC (rev 2364) @@ -41,6 +41,9 @@ #include "directshow/dx_audio_player.h" #include "mffmTimeCode/smilTimeCode.H" +#if _DEBUG +//#include <vld.h> +#endif #ifdef _MSC_VER #pragma warning(disable : 4251) Modified: branches/amis3/AmisCore/include/Media.h =================================================================== --- branches/amis3/AmisCore/include/Media.h 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisCore/include/Media.h 2008-03-02 12:18:00 UTC (rev 2364) @@ -52,7 +52,7 @@ { public: MediaNode(); - virtual ~MediaNode() = 0; + ~MediaNode(); virtual MediaNode* clone() = 0; Modified: branches/amis3/AmisCore/src/Media.cpp =================================================================== --- branches/amis3/AmisCore/src/Media.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisCore/src/Media.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -38,6 +38,14 @@ amis::MediaNode::~MediaNode() { + mId.clear(); + mId.erase(); + mSrc.clear(); + mSrc.erase(); + mHref.clear(); + mHref.erase(); + mLangCode.clear(); + mLangCode.erase(); } void amis::MediaNode::setId(string id) @@ -120,6 +128,7 @@ amis::TextNode::~TextNode() { mText.clear(); + mText.erase(); } void amis::TextNode::setTextString(wstring text) @@ -167,8 +176,11 @@ amis::AudioNode::~AudioNode() { - mClipBegin = ""; - mClipEnd = ""; + mClipBegin.clear(); + mClipBegin.erase(); + + mClipEnd.clear(); + mClipEnd.erase(); } void amis::AudioNode::setClipBegin(const string clipBegin) @@ -357,7 +369,7 @@ void amis::MediaGroup::setId(string id) { - mId = id; + mId.assign(id); } string amis::MediaGroup::getId() Modified: branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/AmisApp.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -120,9 +120,10 @@ BOOL CAmisApp::InitInstance() { - HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + + /* HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == S_FALSE) CoUninitialize(); - assert(hr == S_OK); + assert(hr == S_OK); */ //this says "use the registry instead of ini files" (for windows-specific app preferences). we use it for UAKs SetRegistryKey(_T("Amis")); @@ -225,7 +226,9 @@ amis::gui::MainWndParts::Instance()->DestroyInstance(); - if (AudioSequencePlayer::InstanceExists())AudioSequencePlayer::Instance()->DestroyInstance(); + if (AudioSequencePlayer::InstanceExists()) { + AudioSequencePlayer::Instance()->DestroyInstance(); + } DataTree::Instance()->DestroyInstance(); @@ -234,7 +237,7 @@ amis::util::Log::Instance()->endLog(); - CoUninitialize(); + //CoUninitialize(); return CWinApp::ExitInstance(); } @@ -273,7 +276,11 @@ } void CAmisApp::initializeSelfVoicing() -{ +{ + //VLDEnable(); + //amis::Preferences::Instance()->setIsSelfVoicing(false); + //return; + DataReader new_data_reader; DataTree* p_new_data_tree; p_new_data_tree = DataTree::Instance(); @@ -287,7 +294,7 @@ new_data_reader.setAppPath(mAppPath); amis::ErrorCode did_it_work = new_data_reader.readFile(lang_xml_file.get_file(), p_new_data_tree); - if (did_it_work == amis::OK) + if (false && did_it_work == amis::OK) { //test print to an output file //p_new_data_tree->testPrint("c:\\devel\\amis\\Langpacks\\sandbox\\dataout.txt"); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/AudioSequencePlayer.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -97,8 +97,6 @@ m_wakeUpOriginator = -1; m_nEndEventsToExpect = 0; - unsigned int threadID; - AmisAudio::Instance()->setCallback((sendMessageCallbackFn)clipFinishedCallback); TTSPlayer::Instance()->setCallback((sendMessageCallbackFn)ttsFinishedCallback); @@ -113,9 +111,8 @@ _ASSERT(m_hEventEnd); ResetEvent(m_hEventEnd); + m_hThread = NULL; - m_hThread = (HANDLE) _beginthreadex(NULL, 0, ThreadProc, (void*) this, 0, &threadID); - _ASSERT(m_hThread != NULL); } void AudioSequencePlayer::waitForSequenceEnd() { @@ -233,6 +230,13 @@ } void AudioSequencePlayer::Play(AudioSequence* audioSequence, bool doNotRegisterInHistory) { + if (m_hThread == NULL) { + + unsigned int threadID; + m_hThread = (HANDLE) _beginthreadex(NULL, 0, ThreadProc, (void*) this, 0, &threadID); + _ASSERT(m_hThread != NULL); + } + { #ifdef CCS_ACTIVE CCS* ccs = new CCS(&m_csSequence); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/Prompt.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -116,6 +116,10 @@ } PromptItem::~PromptItem() { + mRefId.clear(); + mRefId.erase(); + mId.clear(); + mId.erase(); } std::string PromptItem::getRefId() @@ -275,12 +279,20 @@ Prompt::Prompt() { mItems.empty(); + mType.clear(); + mId.clear(); } Prompt::~Prompt() { + mType.clear(); + mId.clear(); + + mType.erase(); + mId.erase(); + PromptItemBase* p_item = NULL; - for (int i=0; i<mItems.size()-1; i--) + for (int i=mItems.size()-1; i>=0; i--) { p_item = mItems[i]; mItems.pop_back(); Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/UiMediaTypes.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -13,6 +13,8 @@ TextNode::~TextNode() { + mMnemonic.clear(); + mMnemonic.erase(); } std::string TextNode::getMnemonic() Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/AccessibleUIDataReader.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -82,7 +82,7 @@ //resolve prompt items - mpData->resolvePromptItemsWithRefIds(); + mpData->resolvePromptItemsWithRefIds(); return (ok ? amis::OK : amis::PARSE_ERROR); } Modified: branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp =================================================================== --- branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp 2008-03-02 02:39:54 UTC (rev 2363) +++ branches/amis3/AmisGuiMFC2/src/gui/self-voicing/datamodel/Action.cpp 2008-03-02 12:18:00 UTC (rev 2364) @@ -22,8 +22,12 @@ p_image = NULL; } - - + mWidgetCategories.clear(); + mWidgetCategories.erase(); + mCondition.clear(); + mCondition.erase(); + if (mAccelerator) delete mAccelerator; + if (mMnemonic) delete mMnemonic; } ImageNode* Action::getImage(ImageType type) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |