diff --git a/src/client.cpp b/src/client.cpp index fb9bab5478..f3b83a89a7 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -738,6 +738,8 @@ void CClient::SetAudioChannels ( const EAudChanConf eNAudChanConf ) QString CClient::SetSndCrdDev ( const QString strNewDev ) { + QString strError = ""; + // if client was running then first // stop it and restart again after new initialization const bool bWasRunning = Sound.IsRunning(); @@ -746,16 +748,23 @@ QString CClient::SetSndCrdDev ( const QString strNewDev ) Sound.Stop(); } - const QString strError = Sound.SetDev ( strNewDev ); + try + { + strError = Sound.SetDev ( strNewDev ); - // init again because the sound card actual buffer size might - // be changed on new device - Init(); + // init again because the sound card actual buffer size might + // be changed on new device + Init(); - if ( bWasRunning ) + if ( bWasRunning ) + { + // restart client + Sound.Start(); + } + } + catch ( const CGenErr& generr ) { - // restart client - Sound.Start(); + strError = generr.GetErrorText(); } // in case of an error inform the GUI about it @@ -853,7 +862,8 @@ void CClient::OnSndCrdReinitRequest ( int iSndCrdResetType ) // audio device notifications can come at any time and they are in a // different thread, therefore we need a mutex here - MutexDriverReinit.lock(); + QMutexLocker locker ( &MutexDriverReinit ); + try { // in older QT versions, enums cannot easily be used in signals without // registering them -> workaroud: we use the int type and cast to the enum @@ -888,7 +898,10 @@ void CClient::OnSndCrdReinitRequest ( int iSndCrdResetType ) Sound.Start(); } } - MutexDriverReinit.unlock(); + catch ( const CGenErr& generr ) + { + strError = generr.GetErrorText(); + } // inform GUI about the sound card device change emit SoundDeviceChanged ( strError ); diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index b102c34724..9c3455e477 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -866,7 +866,7 @@ void CClientDlg::OnCLVersionAndOSReceived ( CHostAddress InetAddr, COSUtil::EOpS { // show the label and hide it after one minute again lblUpdateCheck->show(); - QTimer::singleShot ( 60000, [this]() { lblUpdateCheck->hide(); } ); + QTimer::singleShot ( 60000, this, [this]() { lblUpdateCheck->hide(); } ); } #endif }