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

[Xen-changelog] [qemu-xen master] ui/gtk: fix "Copy" menu item segfault



commit a08156321ab9a7d2fed9ee77dbfeea2a61ffd153
Author:     Stefan Hajnoczi <stefanha@xxxxxxxxxx>
AuthorDate: Wed Dec 14 14:25:18 2016 +0000
Commit:     Stefan Hajnoczi <stefanha@xxxxxxxxxx>
CommitDate: Wed Dec 14 18:46:21 2016 +0000

    ui/gtk: fix "Copy" menu item segfault
    
    The "Copy" menu item copies VTE terminal text to the clipboard.  This
    only works with VTE terminals, not with graphics consoles.
    
    Disable the menu item when the current notebook page isn't a VTE
    terminal.
    
    This patch fixes a segfault.  Reproducer: Start QEMU and click the Copy
    menu item when the guest display is visible.
    
    Reported-by: Kevin Wolf <kwolf@xxxxxxxxxx>
    Reviewed-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
    Tested-by: Stefan Weil <sw@xxxxxxxxxxx>
    Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
    Message-id: 20161214142518.10504-1-stefanha@xxxxxxxxxx
    Cc: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx>
    Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
---
 ui/gtk.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index e816428..a216216 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1581,6 +1581,9 @@ static void gd_change_page(GtkNotebook *nb, gpointer 
arg1, guint arg2,
                                        TRUE);
     }
     gtk_widget_set_sensitive(s->grab_item, on_vga);
+#ifdef CONFIG_VTE
+    gtk_widget_set_sensitive(s->copy_item, vc->type == GD_VC_VTE);
+#endif
 
     gd_update_windowsize(vc);
     gd_update_cursor(vc);
@@ -2246,6 +2249,11 @@ void gtk_display_init(DisplayState *ds, bool 
full_screen, bool grab_on_hover)
     }
 #endif
 
+#ifdef CONFIG_VTE
+    gtk_widget_set_sensitive(s->copy_item,
+                             gd_vc_find_current(s)->type == GD_VC_VTE);
+#endif
+
     if (full_screen) {
         gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.