[PATCH spice-gtk 2/5] playback: do not set mm time when session-less

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]