[virt-tools-list] [PATCH virt-viewer v2] app: Do not show usbredir button without session

Fabiano Fidêncio fabiano at fidencio.org
Mon Feb 15 07:20:48 UTC 2016


On Mon, Feb 15, 2016 at 8:15 AM, Pavel Grunt <pgrunt at redhat.com> wrote:
> The button is visible in the fullscreen toolbar when waiting for a guest.
> Clicking on it causes the runtime warning:
> virt-viewer-CRITICAL **: virt_viewer_session_usb_device_selection: assertion 'VIRT_VIEWER_IS_SESSION(self)' failed
> ---
> v2: changed commit message
> ---
>  src/virt-viewer-app.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 653b30c..de7874b 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -903,6 +903,13 @@ viewer_window_focus_out_cb(GtkWindow *window G_GNUC_UNUSED,
>      return FALSE;
>  }
>
> +static gboolean
> +virt_viewer_app_has_usbredir(VirtViewerApp *self)
> +{
> +    return virt_viewer_app_has_session(self) &&
> +           virt_viewer_session_get_has_usbredir(virt_viewer_app_get_session(self));
> +}
> +
>  static VirtViewerWindow*
>  virt_viewer_app_window_new(VirtViewerApp *self, gint nth)
>  {
> @@ -921,10 +928,7 @@ virt_viewer_app_window_new(VirtViewerApp *self, gint nth)
>      self->priv->windows = g_list_append(self->priv->windows, window);
>      virt_viewer_app_set_window_subtitle(self, window, nth);
>      virt_viewer_app_update_menu_displays(self);
> -    if (self->priv->session) {
> -        virt_viewer_window_set_usb_options_sensitive(window,
> -                    virt_viewer_session_get_has_usbredir(self->priv->session));
> -    }
> +    virt_viewer_window_set_usb_options_sensitive(window, virt_viewer_app_has_usbredir(self));
>
>      g_signal_emit(self, signals[SIGNAL_WINDOW_ADDED], 0, window);
>
> --
> 2.5.0
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Acked-by: Fabiano Fidêncio <fidencio at redhat.com>

-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list