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

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

 



From: Victor Toso <me@xxxxxxxxxxxxxx>

---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]