summaryrefslogtreecommitdiff
path: root/gtk/spice-channel.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2014-11-09 21:47:41 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2014-12-01 17:29:56 +0100
commit8943d232995147214e39314ec375d3e6f3a91bff (patch)
tree00aaa4295baffa013c48d774e4e6f847484ffa12 /gtk/spice-channel.c
parenta67e5df1496812e6bc8405be95144f0eddc334b8 (diff)
session: remove channels on disconnect
A channel is considered to be part of a session as long as it is alive. However, this model is problematic, since library user may hold channel references, and thus the channel will remain in the session. Calling spice_session_disconnect() several time will end up calling spice_channel_destroy(), releasing references that aren't owned by the session. This usually causes crashes, in particular with language bindings that do not deal well with a library model where objects can't be referenced at will.
Diffstat (limited to 'gtk/spice-channel.c')
-rw-r--r--gtk/spice-channel.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 154dacb..7c18d87 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -152,9 +152,6 @@ static void spice_channel_dispose(GObject *gobject)
CHANNEL_DEBUG(channel, "%s %p", __FUNCTION__, gobject);
- if (c->session)
- spice_session_channel_destroy(c->session, channel);
-
spice_channel_disconnect(channel, SPICE_CHANNEL_CLOSED);
if (c->session) {
@@ -2041,7 +2038,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
* spice_channel_destroy:
* @channel:
*
- * Disconnect and unref the @channel. Called by @spice_session_disconnect()
+ * Disconnect and unref the @channel. Called by @spice_session_channel_destroy()
*
**/
void spice_channel_destroy(SpiceChannel *channel)