File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -876,7 +876,13 @@ void CClientDlg::OnChatTextReceived ( QString strChatText )
876876{
877877 if ( pSettings->bEnableAudioAlerts )
878878 {
879- QSoundEffect* sf = new QSoundEffect ();
879+ QSoundEffect* sf = new QSoundEffect ( this );
880+ connect ( sf, &QSoundEffect::playingChanged, this , [sf]() {
881+ if ( !sf->isPlaying () )
882+ {
883+ sf->deleteLater ();
884+ }
885+ } );
880886 sf->setSource ( QUrl::fromLocalFile ( " :sounds/res/sounds/new_message.wav" ) );
881887 sf->play ();
882888 }
@@ -927,7 +933,13 @@ void CClientDlg::OnNumClientsChanged ( int iNewNumClients )
927933{
928934 if ( pSettings->bEnableAudioAlerts && iNewNumClients > iClients )
929935 {
930- QSoundEffect* sf = new QSoundEffect ();
936+ QSoundEffect* sf = new QSoundEffect ( this );
937+ connect ( sf, &QSoundEffect::playingChanged, this , [sf]() {
938+ if ( !sf->isPlaying () )
939+ {
940+ sf->deleteLater ();
941+ }
942+ } );
931943 sf->setSource ( QUrl::fromLocalFile ( " :sounds/res/sounds/new_user.wav" ) );
932944 sf->play ();
933945 }
You can’t perform that action at this time.
0 commit comments