gnome-bluetooth r414 - trunk/properties
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-bluetooth r414 - trunk/properties
- Date: Sat, 28 Feb 2009 23:35:40 +0000 (UTC)
Author: hadess
Date: Sat Feb 28 23:35:40 2009
New Revision: 414
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=414&view=rev
Log:
Fix a few memleaks
libhal_device_get_property_string() returns allocated
memory, not a const. Unref the D-Bus call when we've
received a reply. Also make sure the data associated
with a widget is killed off.
Modified:
trunk/properties/killswitch.c
Modified: trunk/properties/killswitch.c
==============================================================================
--- trunk/properties/killswitch.c (original)
+++ trunk/properties/killswitch.c Sat Feb 28 23:35:40 2009
@@ -53,6 +53,7 @@
}
dbus_message_unref(reply);
+ dbus_pending_call_unref (call);
gtk_widget_set_sensitive(button, TRUE);
}
@@ -121,20 +122,22 @@
DBusPendingCall *call;
DBusMessage *message;
GtkWidget *button;
- const char *type, *name;
+ char *type, *name;
type = libhal_device_get_property_string(halctx, udi,
"killswitch.type", NULL);
- if (type == NULL || g_str_equal(type, "bluetooth") == FALSE)
+ if (type == NULL || g_str_equal(type, "bluetooth") == FALSE) {
+ g_free (type);
return FALSE;
+ }
+ g_free (type);
name = libhal_device_get_property_string(halctx, udi,
"info.product", NULL);
- if (name == NULL)
- name = "Bluetooth Switch";
- button = gtk_check_button_new_with_label(name);
- g_object_set_data(G_OBJECT(button), "UDI", g_strdup(udi));
+ button = gtk_check_button_new_with_label(name ? name : _("Bluetooth Switch"));
+ g_free (name);
+ g_object_set_data_full(G_OBJECT(button), "UDI", g_strdup(udi), (GDestroyNotify) g_free);
gtk_widget_set_sensitive(button, FALSE);
gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(button), "toggled",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]