[Clientapps-cvs] symbianMmf/audiocontroller hxmmfaudioctrl.cpp, 1.23, 1.24
anuj_dhamija at helixcommunity.org anuj_dhamija at helixcommunity.orgUpdate of /cvsroot/clientapps/symbianMmf/audiocontroller In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv22178 Modified Files: hxmmfaudioctrl.cpp Log Message: "Nokia submits this code under the terms of a commercial contribution agreement with RealNetworks, and I am authorized to contribute this code under said agreement." Ref: TSW EVFG-7B6CT9 Modified by: ext-anuj.dhamija at nokia.com Date: 02/05/2008 Project: SymbianMmf_rel Synopsis: Playing an Invalid/Corrupt/Unsupported Audio File with Helix Audio Controller causes Helix to crash. Overview: Inside CHXAudioController::AddDataSourceL method m_pDataSource is initialized to instance of CASynchronousMultiReader which internally creates an object of CASynchronousReader wherein address of the reference to the source (passed as argument of AddDataSourceL) method is stored. Since file is not supported, AddDataSourceL function leaves with call to User::Leave causing trap at Framework (CMMFController). On getting error, Framework deletes the source as part of deletion of CMMFDataSourceHolder object. This causes the pointer to this source inside CASynchronousReader object to become dangling. Consequent call to the destructor of CASynchronousReader object (as part of releasing of resources) causes the crash when this pointer is used to access some member method (SinkThreadLogoff method of CMMFClip). Fix: Before CHXAudioController invokes User::Leave in case of unsuccessful return of AddDataSourceL, instruct m_pDataSource to reset the data source pointer to NULL across all the components to which the reference is passed. This ensures that no further operations on this particular source pointer is performed in following cleanup. Files modified & changes: \common\fileio\pub\platform\symbian\asynchronousmultireader.h - New method Close() CAReadingScheduler which further invokes Close method of ASynchronousReader object (m_pReader) \common\fileio\pub\platform\symbian\asynchronousmultireader.cpp - CAsynchronousMultiReader::Close() : Invoke Close() method on AReadingScheduler instance - CAsynchronousReader::Close : set CMMFClip instance m_pImpl to NULL \clientapps\symbianMmf\audiocontroller\hxmmfaudioctrl.cpp - CHXAudioController::AddDataSourceL(): invoke Close() on m_pDataSource before calling User::Leave Unit Testing: A) Play an Corrupt/unsupported Real Media Audio file. Message "Invalid Clip" is displayed and no crash. B) Play a valid Real Media Audio File. It plays fine. Image Size and Heap Use impact: None Module Release testing (STIF, Audio) : Passed Test case(s) Added : No Memory leak check performed : Passed, No leaks found Platforms and Profiles Build Verified: helix-client-s60-32-mmf-mdf-arm Platforms and Profiles Functionality verified: armv5 Branch: Head, 221Cays & 210CayS Index: hxmmfaudioctrl.cpp =================================================================== RCS file: /cvsroot/clientapps/symbianMmf/audiocontroller/hxmmfaudioctrl.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- hxmmfaudioctrl.cpp 8 Feb 2008 18:37:30 -0000 1.23 +++ hxmmfaudioctrl.cpp 25 Feb 2008 20:01:15 -0000 1.24 @@ -937,6 +937,14 @@ { HXLOGL1( HXLOG_SMMF, "CHXAudioController::AddDataSourceL() Failed : %d", lError); + //Before control is passed back to Framework as result of Leave + //close the data source so as to set the souce pointers to NULL + //Framework delets the source on error and setting these to NULL + //ensures no cleanup operations are performed when resources are released + if(m_pDataSource) + { + m_pDataSource->Close(); + } User::Leave(lError); }