Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package mate-power-manager

+  * debian/patches:
+    + Add 0003_fix-power-statistics-when-unplugging-wireless-device-with-
+      battery.patch. Fix crashes of mate-power-statistics when unplugging
+      wireless devices that have a battery (e.g. wireless mouse). The crashes
+      were due to a not fully implemented adaptation to API changes in upower
+      0.99 API. (Closes:  #780844).

-> This patch/upload fixes yet another crash in mate-power-statistics.
There may even come a follow-up upload, because when testing I discovered
one more (unrelated to the above issue) segfault [1] when clicking
through the mate-power-statistics GUI.

light+love,
Mike

[1] https://github.com/mate-desktop/mate-power-manager/issues/142

unblock mate-power-manager/1.8.1+dfsg1-5

-- System Information:
Debian Release: 8.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'testing-updates'), (500, 
'testing-proposed-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
diff -Nru mate-power-manager-1.8.1+dfsg1/debian/changelog mate-power-manager-1.8.1+dfsg1/debian/changelog
--- mate-power-manager-1.8.1+dfsg1/debian/changelog	2015-03-05 08:10:57.000000000 +0100
+++ mate-power-manager-1.8.1+dfsg1/debian/changelog	2015-04-03 16:03:01.000000000 +0200
@@ -1,3 +1,14 @@
+mate-power-manager (1.8.1+dfsg1-5) unstable; urgency=medium
+
+  * debian/patches:
+    + Add 0003_fix-power-statistics-when-unplugging-wireless-device-with-
+      battery.patch. Fix crashes of mate-power-statistics when unplugging
+      wireless devices that have a battery (e.g. wireless mouse). The crashes
+      were due to a not fully implemented adaptation to API changes in upower
+      0.99 API. (Closes:  #780844).
+
+ -- Mike Gabriel <sunwea...@debian.org>  Fri, 03 Apr 2015 16:02:50 +0200
+
 mate-power-manager (1.8.1+dfsg1-4) unstable; urgency=medium
 
   * debian/patches:
diff -Nru mate-power-manager-1.8.1+dfsg1/debian/patches/0003_fix-power-statistics-when-unplugging-wireless-device-with-battery.patch mate-power-manager-1.8.1+dfsg1/debian/patches/0003_fix-power-statistics-when-unplugging-wireless-device-with-battery.patch
--- mate-power-manager-1.8.1+dfsg1/debian/patches/0003_fix-power-statistics-when-unplugging-wireless-device-with-battery.patch	1970-01-01 01:00:00.000000000 +0100
+++ mate-power-manager-1.8.1+dfsg1/debian/patches/0003_fix-power-statistics-when-unplugging-wireless-device-with-battery.patch	2015-04-03 15:59:06.000000000 +0200
@@ -0,0 +1,193 @@
+From 125bdfed22d23f6239b266426acf8fb8508691b8 Mon Sep 17 00:00:00 2001
+From: Monsta <mon...@inbox.ru>
+Date: Tue, 10 Mar 2015 14:38:07 +0300
+Subject: [PATCH] statistics: adjustment for API breakage in upower 0.99
+
+---
+ src/gpm-statistics.c | 99 +++++++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 71 insertions(+), 28 deletions(-)
+
+diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
+index 13489dc..ecb71a7 100644
+--- a/src/gpm-statistics.c
++++ b/src/gpm-statistics.c
+@@ -1183,10 +1183,33 @@ gpm_stats_window_activated_cb (EggUnique *egg_unique, gpointer data)
+ }
+ 
+ /**
++ * gpm_stats_device_changed_cb:
++ **/
++static void
++#if UP_CHECK_VERSION(0, 99, 0)
++gpm_stats_device_changed_cb (UpDevice *device, GParamSpec *pspec, gpointer user_data)
++#else
++gpm_stats_device_changed_cb (UpClient *client, UpDevice *device, gpointer user_data)
++#endif
++{
++	const gchar *object_path;
++	object_path = up_device_get_object_path (device);
++	if (object_path == NULL || current_device == NULL)
++		return;
++	egg_debug ("changed:   %s", object_path);
++	if (g_strcmp0 (current_device, object_path) == 0)
++		gpm_stats_update_info_data (device);
++}
++
++/**
+  * gpm_stats_add_device:
+  **/
+ static void
++#if UP_CHECK_VERSION(0, 99, 0)
++gpm_stats_add_device (UpDevice *device, GPtrArray *devices)
++#else
+ gpm_stats_add_device (UpDevice *device)
++#endif
+ {
+ 	const gchar *id;
+ 	GtkTreeIter iter;
+@@ -1194,6 +1217,14 @@ gpm_stats_add_device (UpDevice *device)
+ 	const gchar *icon;
+ 	UpDeviceKind kind;
+ 
++#if UP_CHECK_VERSION(0, 99, 0)
++	if (devices != NULL)
++		g_ptr_array_add (devices, device);
++
++	g_signal_connect (device, "notify",
++	                  G_CALLBACK (gpm_stats_device_changed_cb), NULL);
++#endif
++
+ 	/* get device properties */
+ 	g_object_get (device,
+ 		      "kind", &kind,
+@@ -1224,48 +1255,51 @@ gpm_stats_data_changed_cb (UpClient *client, gpointer user_data)
+  * gpm_stats_device_added_cb:
+  **/
+ static void
++#if UP_CHECK_VERSION(0, 99, 0)
++gpm_stats_device_added_cb (UpClient *client, UpDevice *device, GPtrArray *devices)
++#else
+ gpm_stats_device_added_cb (UpClient *client, UpDevice *device, gpointer user_data)
++#endif
+ {
+ 	const gchar *object_path;
+ 	object_path = up_device_get_object_path (device);
+ 	egg_debug ("added:     %s", object_path);
+-	gpm_stats_add_device (device);
+-}
+ 
+-/**
+- * gpm_stats_device_changed_cb:
+- **/
+-static void
+ #if UP_CHECK_VERSION(0, 99, 0)
+-gpm_stats_device_changed_cb (UpClient *client, GParamSpec *pspec, gpointer user_data)
+-{
+-	gpm_stats_button_update_ui();
+-}
++	gpm_stats_add_device (device, devices);
+ #else
+-gpm_stats_device_changed_cb (UpClient *client, UpDevice *device, gpointer user_data)
+-{
+-	const gchar *object_path;
+-	object_path = up_device_get_object_path (device);
+-	if (object_path == NULL || current_device == NULL)
+-		return;
+-	egg_debug ("changed:   %s", object_path);
+-	if (g_strcmp0 (current_device, object_path) == 0)
+-		gpm_stats_update_info_data (device);
+-}
++	gpm_stats_add_device (device);
+ #endif
++}
+ 
+ /**
+  * gpm_stats_device_removed_cb:
+  **/
+ static void
++#if UP_CHECK_VERSION(0, 99, 0)
++gpm_stats_device_removed_cb (UpClient *client, const gchar *object_path, GPtrArray *devices)
++#else
+ gpm_stats_device_removed_cb (UpClient *client, UpDevice *device, gpointer user_data)
++#endif
+ {
+-	const gchar *object_path;
+ 	GtkTreeIter iter;
+ 	gchar *id = NULL;
+ 	gboolean ret;
+ 
+-	object_path = up_device_get_object_path (device);
++#if UP_CHECK_VERSION(0, 99, 0)
++	UpDevice *device_tmp;
++	guint i;
++
++	for (i = 0; i < devices->len; i++) {
++		device_tmp = g_ptr_array_index (devices, i);
++		if (g_strcmp0 (up_device_get_object_path (device_tmp), object_path) == 0) {
++			g_ptr_array_remove_index_fast (devices, i);
++			break;
++		}
++	}
++#else
++	const gchar *object_path = up_device_get_object_path (device);
++#endif
+ 	egg_debug ("removed:   %s", object_path);
+ 	if (g_strcmp0 (current_device, object_path) == 0) {
+ 		gtk_list_store_clear (list_store_info);
+@@ -1545,7 +1579,7 @@ main (int argc, char *argv[])
+ 	EggUnique *egg_unique;
+ 	gboolean ret;
+ 	UpClient *client;
+-	GPtrArray *devices;
++	GPtrArray *devices = NULL;
+ 	UpDevice *device;
+ 	UpDeviceKind kind;
+ 	guint i, j;
+@@ -1815,16 +1849,24 @@ main (int argc, char *argv[])
+ 			device = g_ptr_array_index (devices, i);
+ 			g_object_get (device, "kind", &kind, NULL);
+ 			if (kind == j)
++#if UP_CHECK_VERSION(0, 99, 0)
++				/* NULL == do not add it to ptr array */
++				gpm_stats_add_device (device, NULL);
++#else
+ 				gpm_stats_add_device (device);
++#endif
+ 		}
+ 	}
+ 
+ 	/* connect now the coldplug is done */
+-	g_signal_connect (client, "device-added", G_CALLBACK (gpm_stats_device_added_cb), NULL);
+-	g_signal_connect (client, "device-removed", G_CALLBACK (gpm_stats_device_removed_cb), NULL);
+ #if UP_CHECK_VERSION(0, 99, 0)
+-	g_signal_connect (client, "notify", G_CALLBACK (gpm_stats_device_changed_cb), NULL);
++	g_signal_connect (client, "device-added", G_CALLBACK (gpm_stats_device_added_cb), devices);
++	g_signal_connect (client, "device-removed", G_CALLBACK (gpm_stats_device_removed_cb), devices);
+ #else
++	g_signal_connect (client, "device-added", G_CALLBACK (gpm_stats_device_added_cb), NULL);
++	g_signal_connect (client, "device-removed", G_CALLBACK (gpm_stats_device_removed_cb), NULL);
++#endif
++#if !UP_CHECK_VERSION(0, 99, 0)
+ 	g_signal_connect (client, "device-changed", G_CALLBACK (gpm_stats_device_changed_cb), NULL);
+ #endif
+ 
+@@ -1854,8 +1896,6 @@ main (int argc, char *argv[])
+ 	if (last_device != NULL)
+ 		gpm_stats_highlight_device (last_device);
+ 
+-	g_ptr_array_unref (devices);
+-
+ 	/* set axis */
+ 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_history_type"));
+ 	gpm_stats_history_type_combo_changed_cb (widget, NULL);
+@@ -1869,6 +1909,9 @@ main (int argc, char *argv[])
+ #if !UP_CHECK_VERSION(0, 99, 0)
+ out:
+ #endif
++	if (devices != NULL)
++		g_ptr_array_unref (devices);
++
+ 	g_object_unref (settings);
+ 	g_object_unref (client);
+ 	g_object_unref (wakeups);
+
diff -Nru mate-power-manager-1.8.1+dfsg1/debian/patches/series mate-power-manager-1.8.1+dfsg1/debian/patches/series
--- mate-power-manager-1.8.1+dfsg1/debian/patches/series	2015-03-05 05:40:46.000000000 +0100
+++ mate-power-manager-1.8.1+dfsg1/debian/patches/series	2015-04-03 15:59:29.000000000 +0200
@@ -1,4 +1,5 @@
 0001_fix-backlight-popup-gtkbuilder.patch
 0002_handle-UP-DEVICE-STATE-UNKNOWN.patch
+0003_fix-power-statistics-when-unplugging-wireless-device-with-battery.patch
 2001_omit-gfdl-licensed-help-files.patch
 2002_compile-extra-man-pages.patch

Reply via email to