From 278a252822c27ee206249fb6fd274e7fb5fe1321 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 30 Nov 2009 21:16:40 +0000 Subject: [PATCH] fix for bug that software crashed in case the driver properties of current selected driver have incompatibly changed --- src/clientsettingsdlg.cpp | 2 +- windows/sound.cpp | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 4a50d687..ce15df4b 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -380,7 +380,7 @@ void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx ) if ( !strError.isEmpty() ) { - QMessageBox::critical ( 0, APP_NAME, + QMessageBox::critical ( this, APP_NAME, QString ( "The selected audio device could not be used because " "of the following error: " ) + strError + QString ( " The previous driver will be selected." ), "Ok", 0 ); diff --git a/windows/sound.cpp b/windows/sound.cpp index 8ac62736..a186c4c4 100755 --- a/windows/sound.cpp +++ b/windows/sound.cpp @@ -76,9 +76,24 @@ std::string CSound::SetDev ( const int iNewDev ) if ( !strErrorMessage.empty() ) { - // loading and initializing the new driver failed, go back to - // original driver and display error message - LoadAndInitializeDriver ( lCurDev ); + if ( iNewDev != lCurDev ) + { + // loading and initializing the new driver failed, go back to + // original driver and display error message + LoadAndInitializeDriver ( lCurDev ); + } + else + { + // the same driver is used but the driver properties seems to + // have changed so that they are not compatible to our + // software anymore + QMessageBox::critical ( + 0, APP_NAME, "The audio driver properties have changed to " + "a state which is incompatible to this software. " + "Please restart the software.", "Close", 0 ); + + _exit ( 0 ); + } // store error return message strReturn = strErrorMessage;