[Spice-devel] [spice-server 2/4] channel: Allow NULL RedChannelClient::on_disconnect()

Christophe Fergeau cfergeau at redhat.com
Wed Aug 30 16:34:52 UTC 2017


SoundChannelClient has a stub implementation of
RedChannelClient::on_disconnect(), this commit removes the need for it.

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 server/red-channel-client.c | 4 +++-
 server/sound.c              | 5 -----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 43b8eb8b2..2612a6db4 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1669,7 +1669,9 @@ static void red_channel_client_on_disconnect(RedChannelClient *rcc)
 {
     RedChannelClientClass *klass = RED_CHANNEL_CLIENT_GET_CLASS(rcc);
 
-    klass->on_disconnect(rcc);
+    if (klass->on_disconnect != NULL) {
+        klass->on_disconnect(rcc);
+    }
 }
 
 void red_channel_client_disconnect(RedChannelClient *rcc)
diff --git a/server/sound.c b/server/sound.c
index 28e18126f..de51a4670 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -789,10 +789,6 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc)
     return true;
 }
 
-static void snd_channel_client_on_disconnect(RedChannelClient *rcc)
-{
-}
-
 static uint8_t*
 snd_channel_client_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size)
 {
@@ -1475,7 +1471,6 @@ snd_channel_client_class_init(SndChannelClientClass *klass)
     client_class->config_socket = snd_channel_client_config_socket;
     client_class->alloc_recv_buf = snd_channel_client_alloc_recv_buf;
     client_class->release_recv_buf = snd_channel_client_release_recv_buf;
-    client_class->on_disconnect = snd_channel_client_on_disconnect;
 }
 
 static void
-- 
2.13.5



More information about the Spice-devel mailing list