[Spice-devel] [spice-gtk] Fix using NULL main channel reference
Marc-André Lureau
marcandre.lureau at gmail.com
Tue Jul 24 15:58:54 UTC 2018
On Mon, Jul 16, 2018 at 6:45 PM, Javier Celaya
<javier.celaya at flexvdi.com> wrote:
> The main channel reference d->main of SpiceWidget is initialized on
> construction. However, it is used a couple of times before that moment
> while setting the default values of some properties, like resize-guest.
> This results in some annoying critical log messages. This commit makes
> sure that d->main is not used in such situations if it is NULL.
Could you provide a reproducer of such warnings? I don't remember seeing one.
> ---
> src/spice-widget.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 72f5334..5187b0c 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -255,7 +255,7 @@ static void update_ready(SpiceDisplay *display)
> * state here. If 'resize-guest' is false, we can assume that the
> * application will manage the state of the displays.
> */
> - if (d->resize_guest_enable) {
> + if (d->resize_guest_enable && d->main) {
> spice_main_channel_update_display_enabled(d->main, get_display_id(display), ready, TRUE);
> }
>
> @@ -1247,7 +1247,7 @@ static void recalc_geometry(GtkWidget *widget)
> d->area.width, d->area.height,
> d->ww, d->wh, zoom);
>
> - if (d->resize_guest_enable)
> + if (d->resize_guest_enable && d->main)
> spice_main_channel_update_display(d->main, get_display_id(display),
> d->area.x, d->area.y, d->ww / zoom, d->wh / zoom, TRUE);
It looks like this may not give you the desired display size.
> }
> --
> 2.17.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
--
Marc-André Lureau
More information about the Spice-devel
mailing list