[spice-gtk] Fix using NULL main channel reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]