Avoids to have not initialised variables before constructed is called. This avoid potentially memory errors while setting properties. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/display-channel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/display-channel.c b/server/display-channel.c index 7ddd44c14..f99fd8faf 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -2277,12 +2277,17 @@ display_channel_init(DisplayChannel *self) self->priv = g_new0(DisplayChannelPrivate, 1); self->priv->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ; self->priv->pub = self; + self->priv->renderer = RED_RENDERER_INVALID; + self->priv->stream_video = SPICE_STREAM_VIDEO_OFF; image_encoder_shared_init(&self->priv->encoder_shared_data); ring_init(&self->priv->current_list); drawables_init(self); self->priv->image_surfaces.ops = &image_surfaces_ops; + + image_cache_init(&self->priv->image_cache); + display_channel_init_video_streams(self); } static void @@ -2295,8 +2300,6 @@ display_channel_constructed(GObject *object) spice_assert(self->priv->video_codecs); - self->priv->renderer = RED_RENDERER_INVALID; - stat_init(&self->priv->add_stat, "add", CLOCK_THREAD_CPUTIME_ID); stat_init(&self->priv->exclude_stat, "exclude", CLOCK_THREAD_CPUTIME_ID); stat_init(&self->priv->__exclude_stat, "__exclude", CLOCK_THREAD_CPUTIME_ID); @@ -2308,9 +2311,6 @@ display_channel_constructed(GObject *object) "add_to_cache", TRUE); stat_init_counter(&self->priv->non_cache_counter, reds, stat, "non_cache", TRUE); - image_cache_init(&self->priv->image_cache); - self->priv->stream_video = SPICE_STREAM_VIDEO_OFF; - display_channel_init_video_streams(self); red_channel_set_cap(channel, SPICE_DISPLAY_CAP_MONITORS_CONFIG); red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION); -- 2.20.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel