[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.8] ui/gtk: fix "Copy" menu item segfault
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH for-2.8] ui/gtk: fix "Copy" menu item segfault |
Date: |
Wed, 14 Dec 2016 16:15:35 +0100 |
On Mi, 2016-12-14 at 14:25 +0000, Stefan Hajnoczi wrote:
> 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.
Reviewed-by: Gerd Hoffmann <address@hidden>
>
> Reported-by: Kevin Wolf <address@hidden>
> Cc: Michael S. Tsirkin <address@hidden>
> Cc: Gerd Hoffmann <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> ui/gtk.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> Gerd, Michael: if you post Reviewed-by I can merge this directly without
> requiring you to send a pull request. It's a user interface segfault so it
> would be nice to resolve it in QEMU 2.8.
>
> 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));
> }