[Spice-commits] server/cursor-channel.c server/display-channel.c server/red-stream-device.c server/red-worker.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 15 09:02:03 UTC 2019


 server/cursor-channel.c    |   12 ++++++++++++
 server/display-channel.c   |    2 ++
 server/red-stream-device.c |    1 -
 server/red-worker.c        |    2 --
 4 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 6f90c003e8b340e2c4d89e972cfe4e658e8abd51
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Thu Mar 14 15:03:21 2019 -0500

    Move channel registration to constructed vfunc
    
    For the Display Channel and the Cursor channel, move the call to
    reds_register_channel() to the _constructed() vfunc rather than calling
    it explicitly from RedWorker. This matches what other channels do.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 9dd69fa2..4220084f 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -367,11 +367,23 @@ cursor_channel_finalize(GObject *object)
 }
 
 static void
+cursor_channel_constructed(GObject *object)
+{
+    RedChannel *red_channel = RED_CHANNEL(object);
+    RedsState *reds = red_channel_get_server(red_channel);
+
+    G_OBJECT_CLASS(cursor_channel_parent_class)->constructed(object);
+
+    reds_register_channel(reds, red_channel);
+}
+
+static void
 cursor_channel_class_init(CursorChannelClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
     RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
 
+    object_class->constructed = cursor_channel_constructed;
     object_class->finalize = cursor_channel_finalize;
 
     channel_class->parser = spice_get_client_channel_parser(SPICE_CHANNEL_CURSOR, NULL);
diff --git a/server/display-channel.c b/server/display-channel.c
index 9bb7fa44..e179abfd 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2305,6 +2305,8 @@ display_channel_constructed(GObject *object)
     red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION);
     red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE);
     red_channel_set_cap(channel, SPICE_DISPLAY_CAP_STREAM_REPORT);
+
+    reds_register_channel(reds, channel);
 }
 
 void display_channel_process_surface_cmd(DisplayChannel *display,
diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index b9e0827a..78a8c908 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -701,7 +701,6 @@ stream_device_create_channel(StreamDevice *dev)
     client_cbs.connect = (channel_client_connect_proc) cursor_channel_connect;
     client_cbs.migrate = cursor_channel_client_migrate;
     red_channel_register_client_cbs(RED_CHANNEL(cursor_channel), &client_cbs);
-    reds_register_channel(reds, RED_CHANNEL(cursor_channel));
 
     dev->stream_channel = stream_channel;
     dev->cursor_channel = cursor_channel;
diff --git a/server/red-worker.c b/server/red-worker.c
index c74ae888..3cb12b9c 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1322,7 +1322,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
     red_channel_init_stat_node(channel, &worker->stat, "cursor_channel");
     red_channel_register_client_cbs(channel, client_cursor_cbs);
     g_object_set_data(G_OBJECT(channel), "dispatcher", dispatcher);
-    reds_register_channel(reds, channel);
 
     // TODO: handle seamless migration. Temp, setting migrate to FALSE
     worker->display_channel = display_channel_new(reds, qxl, &worker->core, FALSE,
@@ -1333,7 +1332,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
     red_channel_init_stat_node(channel, &worker->stat, "display_channel");
     red_channel_register_client_cbs(channel, client_display_cbs);
     g_object_set_data(G_OBJECT(channel), "dispatcher", dispatcher);
-    reds_register_channel(reds, channel);
 
     return worker;
 }


More information about the Spice-commits mailing list