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,14 @@ 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+ {
882+ if ( !sf->isPlaying () )
883+ {
884+ sf->deleteLater ();
885+ }
886+ } );
880887 sf->setSource ( QUrl::fromLocalFile ( " :sounds/res/sounds/new_message.wav" ) );
881888 sf->play ();
882889 }
@@ -927,7 +934,14 @@ void CClientDlg::OnNumClientsChanged ( int iNewNumClients )
927934{
928935 if ( pSettings->bEnableAudioAlerts && iNewNumClients > iClients )
929936 {
930- QSoundEffect* sf = new QSoundEffect ();
937+ QSoundEffect* sf = new QSoundEffect ( this );
938+ connect ( sf, &QSoundEffect::playingChanged, this , [sf]()
939+ {
940+ if ( !sf->isPlaying () )
941+ {
942+ sf->deleteLater ();
943+ }
944+ } );
931945 sf->setSource ( QUrl::fromLocalFile ( " :sounds/res/sounds/new_user.wav" ) );
932946 sf->play ();
933947 }
You can’t perform that action at this time.
0 commit comments