[PATCH spice-gtk] spice-channel: return if has_error is TRUE in spice_channel_write_msg

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

 



Avoid linearizing if the message isn't written out anyway
(spice_channel_flush_wire checks() this condition as well).

This also silences the following error:

    (spicy:32087): GSpice-CRITICAL **: 16:22:03.147: spice_session_get_read_only: assertion 'SPICE_IS_SESSION(self)' failed

that can be seen if the channel gets disconnected
by the session while having non-empty write queue.

spice_session_channel_destroy() sets channel->priv->session to NULL,
but spice_channel_write_msg() subsequently attempts to call
spice_session_get_read_only() with NULL pointer.

Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx>
---
 src/spice-channel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index 61de177..aa80edf 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -897,6 +897,11 @@ static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out)
     g_return_if_fail(out != NULL);
     g_return_if_fail(channel == out->channel);
 
+    if (channel->priv->has_error) {
+        spice_msg_out_unref(out);
+        return;
+    }
+
     if (out->ro_check &&
         spice_channel_get_read_only(channel)) {
         g_warning("Try to send message while read-only. Please report a bug.");
-- 
2.21.0

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




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