From 3fded0b515b991b924ff80f3992dfeba8f3f0b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 14 Feb 2020 14:51:39 +0100 Subject: [PATCH] desklink: watch media_server quit event to disconnect itself. StartWatching() must be called for each notification type. Change-Id: I34957af526a0af557a86eef0c3de5722f3503ca5 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2244 Reviewed-by: Adrien Destugues --- src/bin/desklink/MediaReplicant.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bin/desklink/MediaReplicant.cpp b/src/bin/desklink/MediaReplicant.cpp index d37a205738..8b43e0e779 100644 --- a/src/bin/desklink/MediaReplicant.cpp +++ b/src/bin/desklink/MediaReplicant.cpp @@ -408,6 +408,10 @@ MediaReplicant::MessageReceived(BMessage* message) _ConnectMixer(); break; + case B_MEDIA_SERVER_QUIT: + _DisconnectMixer(); + break; + case B_MEDIA_NODE_CREATED: { // It's not enough to wait for B_MEDIA_SERVER_STARTED message, as @@ -594,7 +598,9 @@ MediaReplicant::_DisconnectMixer() if (roster == NULL) return; - roster->StopWatching(this, B_MEDIA_SERVER_STARTED | B_MEDIA_NODE_CREATED); + roster->StopWatching(this, B_MEDIA_SERVER_STARTED); + roster->StopWatching(this, B_MEDIA_SERVER_QUIT); + roster->StopWatching(this, B_MEDIA_NODE_CREATED); if (fMixerControl == NULL) return; @@ -618,7 +624,9 @@ MediaReplicant::_ConnectMixer() if (roster == NULL) return B_ERROR; - roster->StartWatching(this, B_MEDIA_SERVER_STARTED | B_MEDIA_NODE_CREATED); + roster->StartWatching(this, B_MEDIA_SERVER_STARTED); + roster->StartWatching(this, B_MEDIA_SERVER_QUIT); + roster->StartWatching(this, B_MEDIA_NODE_CREATED); fMixerControl = new MixerControl(fVolumeWhich);