[virt-tools-list] [PATCH virt-viewer] Fix segmentation fault on zoom

Charles Arnold carnold at suse.com
Tue Jun 7 19:51:49 UTC 2016


When virt-viewer is "Waiting for guest domain to start" and
the Ctrl- or Ctrl+ keys are pressed to zoom the blank display
virt-viewer will crash in virt_viewer_display_get_desktop_size
because of a NULL display pointer. To reproduce start virt-viewer
on a VM not running and zoom the display.

Signed-off-by: Charles Arnold <carnold at suse.com>

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index ef62d9a..939f5f8 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -388,6 +388,9 @@ G_MODULE_EXPORT void
 virt_viewer_window_menu_view_zoom_out(GtkWidget *menu G_GNUC_UNUSED,
                                       VirtViewerWindow *self)
 {
+    if ( self->priv->display == NULL )
+        return;
+
     virt_viewer_window_set_zoom_level(self,
                                       virt_viewer_window_get_real_zoom_level(self) - ZOOM_STEP);
 }
@@ -396,6 +399,9 @@ G_MODULE_EXPORT void
 virt_viewer_window_menu_view_zoom_in(GtkWidget *menu G_GNUC_UNUSED,
                                      VirtViewerWindow *self)
 {
+    if ( self->priv->display == NULL )
+        return;
+
     virt_viewer_window_set_zoom_level(self,
                                       virt_viewer_window_get_real_zoom_level(self) + ZOOM_STEP);
 }






More information about the virt-tools-list mailing list