diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp index 178f451..93c84ca 100644 --- a/app/PlaYUVerApp.cpp +++ b/app/PlaYUVerApp.cpp @@ -239,10 +239,10 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) videoSubWindow->close(); } } - catch( const char *msg ) + catch( PlaYUVerFailure& e ) { videoSubWindow->close(); - QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + msg; + QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + e.what(); QMessageBox::warning( this, QApplication::applicationName(), warningMsg ); printMessage( warningMsg, LOG_ERROR ); } @@ -329,10 +329,10 @@ Void PlaYUVerApp::save() { saveWindow->save( fileName ); } - catch( const char *msg ) + catch( PlaYUVerFailure& e ) { QApplication::restoreOverrideCursor(); - QString warningMsg = "Cannot save file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + msg; + QString warningMsg = "Cannot save file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + e.what(); QMessageBox::warning( this, QApplication::applicationName(), warningMsg ); printMessage( warningMsg, LOG_ERROR ); return; @@ -353,9 +353,9 @@ Void PlaYUVerApp::format() addStreamInfoToRecentList( pcVideoSubWindow->getStreamInfo() ); } } - catch( const char *msg ) + catch( PlaYUVerFailure& e ) { - QString warningMsg = "Cannot change format of " + QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + msg; + QString warningMsg = "Cannot change format of " + QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + e.what(); QMessageBox::warning( this, QApplication::applicationName(), warningMsg ); printMessage( warningMsg, LOG_ERROR ); qDebug( ) << warningMsg; diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 7dc7798..04a46a1 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -330,7 +330,7 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) { m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, true ); } - catch( const char *msg ) + catch( ... ) { if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate ) == QDialog::Rejected ) diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index c8e6f4d..2a14846 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -237,7 +237,7 @@ Bool PlaYUVerStream::open( String filename, UInt width, UInt height, Int input_f m_ppcFrameBuffer[i] = new PlaYUVerFrame( m_pcHandler->m_uiWidth, m_pcHandler->m_uiHeight, m_pcHandler->m_iPixelFormat, m_pcHandler->m_uiBitsPerPixel, m_pcHandler->m_iEndianness ); } - catch( const char *msg ) + catch( PlaYUVerFailure& e ) { close(); throw PlaYUVerFailure( "PlaYUVerStream", "Cannot allocated frame buffer" ); @@ -308,6 +308,7 @@ Void PlaYUVerStream::close() return; m_pcHandler->closeHandler(); + m_pcHandler->Delete(); if( m_ppcFrameBuffer ) { diff --git a/lib/PlaYUVerStreamHandlerIf.h b/lib/PlaYUVerStreamHandlerIf.h index 445fff9..0f4ae59 100644 --- a/lib/PlaYUVerStreamHandlerIf.h +++ b/lib/PlaYUVerStreamHandlerIf.h @@ -57,6 +57,8 @@ class PlaYUVerStreamHandlerIf { } + virtual void Delete() = 0; + virtual Bool openHandler( String strFilename, Bool bInput ) = 0; virtual Void closeHandler() = 0; virtual Bool configureBuffer( PlaYUVerFrame* pcFrame ) = 0;