--- a/panel-plugins/power-manager-plugin/power-manager-button.c
+++ b/panel-plugins/power-manager-plugin/power-manager-button.c
@@ -417,7 +417,7 @@
/* update the image, keep track of the signal ids and the img
* so we can disconnect it later */
battery_device->img = gtk_image_new_from_pixbuf(battery_device->pix);
- g_object_ref (battery_device->img);
+
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(battery_device->menu_item), battery_device->img);
battery_device->expose_signal_id = g_signal_connect_after (G_OBJECT (battery_device->img),
"expose-event",
@@ -525,6 +525,8 @@
g_free(battery_device->details);
g_free(battery_device->object_path);
+ battery_device_remove_pix (battery_device);
+
if (battery_device->device != NULL && UP_IS_DEVICE(battery_device->device))
{
/* disconnect the signal handler if we were using it */
@@ -535,6 +537,8 @@
g_object_unref (battery_device->device);
battery_device->device = NULL;
}
+
+ g_free (battery_device);
}
static void