From 8edd8b06c1be4fc45d2370ca287421674f090d22 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Wed, 29 Apr 2015 16:16:35 +0200 Subject: playback: do not set mm time when session-less Channels do not hold a strong reference on the session (because session can be recycled after disconnect), do not print a warning if the channel is session-less when updating the delay. --- gtk/channel-playback.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c index 9d45e1f..d8a181e 100644 --- a/gtk/channel-playback.c +++ b/gtk/channel-playback.c @@ -452,6 +452,7 @@ static void channel_set_handlers(SpiceChannelClass *klass) void spice_playback_channel_set_delay(SpicePlaybackChannel *channel, guint32 delay_ms) { SpicePlaybackChannelPrivate *c; + SpiceSession *session; g_return_if_fail(SPICE_IS_PLAYBACK_CHANNEL(channel)); @@ -459,8 +460,13 @@ void spice_playback_channel_set_delay(SpicePlaybackChannel *channel, guint32 del c = channel->priv; c->latency = delay_ms; - spice_session_set_mm_time(spice_channel_get_session(SPICE_CHANNEL(channel)), - c->last_time - delay_ms); + + session = spice_channel_get_session(SPICE_CHANNEL(channel)); + if (session) { + spice_session_set_mm_time(session, c->last_time - delay_ms); + } else { + CHANNEL_DEBUG(channel, "channel detached from session, mm time skipped"); + } } G_GNUC_INTERNAL -- cgit v1.2.3