From: Victor Toso <m...@victortoso.com>

Instead of accessing Private of SpiceChannel.

Signed-off-by: Victor Toso <victort...@redhat.com>
---
 src/channel-usbredir.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index e407bac..fed9bd4 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -511,7 +511,6 @@ static void usbredir_free_write_cb_data(uint8_t *data, void 
*user_data)
 #ifdef USE_LZ4
 static int try_write_compress_LZ4(SpiceUsbredirChannel *channel, uint8_t 
*data, int count)
 {
-    SpiceChannelPrivate *c;
     SpiceMsgOut *msg_out_compressed;
     int bound, compressed_data_count;
     uint8_t *compressed_buf;
@@ -520,11 +519,15 @@ static int try_write_compress_LZ4(SpiceUsbredirChannel 
*channel, uint8_t *data,
         .uncompressed_size = count
     };
 
-    c = SPICE_CHANNEL(channel)->priv;
-    if (g_socket_get_family(c->sock) == G_SOCKET_FAMILY_UNIX) {
+    GSocket *sock;
+    g_object_get(channel, "socket", &sock, NULL);
+    if (g_socket_get_family(sock) == G_SOCKET_FAMILY_UNIX) {
+        g_object_unref(sock);
         /* AF_LOCAL socket - data will not be compressed */
         return FALSE;
     }
+    g_object_unref(sock);
+
     if (count <= COMPRESS_THRESHOLD) {
         /* Not enough data to compress */
         return FALSE;
-- 
2.21.0

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

Reply via email to