[Spice-devel] [spice-gtk] usb-device-widget: use g_clear_pointer

Christophe Fergeau cfergeau at redhat.com
Mon Oct 1 16:04:09 UTC 2018


Looks good, but I don't know how much this interferes with the
changes Yuri is doing to that code? Should only cause minor commits
though.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Mon, Oct 01, 2018 at 05:49:42PM +0200, Victor Toso wrote:
> From: Victor Toso <me at victortoso.com>
> 
> ---
>  src/usb-device-widget.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
> index d6e440c..da24d00 100644
> --- a/src/usb-device-widget.c
> +++ b/src/usb-device-widget.c
> @@ -135,10 +135,7 @@ static void spice_usb_device_widget_hide_info_bar(SpiceUsbDeviceWidget *self)
>  {
>      SpiceUsbDeviceWidgetPrivate *priv = self->priv;
>  
> -    if (priv->info_bar) {
> -        gtk_widget_destroy(priv->info_bar);
> -        priv->info_bar = NULL;
> -    }
> +    g_clear_pointer(&priv->info_bar, gtk_widget_destroy);
>  }
>  
>  static void
> @@ -412,8 +409,7 @@ static gboolean spice_usb_device_widget_update_status(gpointer user_data)
>          spice_usb_device_widget_show_info_bar(self, priv->err_msg,
>                                                GTK_MESSAGE_INFO,
>                                                "dialog-warning");
> -        g_free(priv->err_msg);
> -        priv->err_msg = NULL;
> +        g_clear_pointer(&priv->err_msg, g_free);
>      } else if (redirecting) {
>          spice_usb_device_widget_show_info_bar(self, _("Redirecting USB Device..."),
>                                                GTK_MESSAGE_INFO,
> -- 
> 2.17.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20181001/9665916f/attachment.sig>


More information about the Spice-devel mailing list