[Spice-devel] [spice-gtk] Fix using NULL main channel reference
Javier Celaya
javier.celaya at flexvdi.com
Mon Jul 16 16:45:35 UTC 2018
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.
---
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);
}
--
2.17.0
More information about the Spice-devel
mailing list