~xavi-garcia-mena/ubuntu/vivid/upower/percentages-power-off

« back to all changes in this revision

Viewing changes to debian/patches/0001-up-client-Really-don-t-overwrite-retval-with-prop-va.patch

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-10-14 11:41:36 UTC
  • Revision ID: package-import@ubuntu.com-20131014114136-fyh80f8bw06jq7wf
Tags: 0.9.22-1ubuntu1
* Cherry-pick two fixes from upstream:
  - up-client: Really don't overwrite retval with prop values. Properties
    and property notification via libupower-glib got broken in 0.9.22.
    Incorrect values were being returned, meaning anything relying on these
    might do the wrong thing, such as in LP: #1238663
  - lib: Fix crasher calling _about_to_sleep_sync(). Crash fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From e4858d94343bba2afbebcd1a4925c981a38a9579 Mon Sep 17 00:00:00 2001
 
2
From: Bastien Nocera <hadess@hadess.net>
 
3
Date: Thu, 10 Oct 2013 18:32:41 +0200
 
4
Subject: [PATCH] up-client: Really don't overwrite retval with prop values
 
5
 
 
6
db89e5a32bf2c16c0d3d00f6c8f0ef7e5e7efa8f was incomplete and
 
7
"ret" was being used instead of prop_val to set some of those
 
8
properties. It's likely your laptop would have been seen as
 
9
docked for example.
 
10
---
 
11
 libupower-glib/up-client.c | 18 +++++++++---------
 
12
 1 file changed, 9 insertions(+), 9 deletions(-)
 
13
 
 
14
diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c
 
15
index 757e4a1..2334a68 100644
 
16
--- a/libupower-glib/up-client.c
 
17
+++ b/libupower-glib/up-client.c
 
18
@@ -360,7 +360,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
19
 
 
20
        prop_val = g_value_get_boolean (value) && allowed;
 
21
        if (prop_val != client->priv->can_suspend) {
 
22
-               client->priv->can_suspend = ret;
 
23
+               client->priv->can_suspend = prop_val;
 
24
                g_object_notify (G_OBJECT(client), "can-suspend");
 
25
        }
 
26
 
 
27
@@ -376,7 +376,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
28
 
 
29
        prop_val = g_value_get_boolean (value) && allowed;
 
30
        if (prop_val != client->priv->can_hibernate) {
 
31
-               client->priv->can_hibernate = ret;
 
32
+               client->priv->can_hibernate = prop_val;
 
33
                g_object_notify (G_OBJECT(client), "can-hibernate");
 
34
        }
 
35
 #endif /* ENABLE_DEPRECATED */
 
36
@@ -388,7 +388,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
37
        }
 
38
        prop_val = g_value_get_boolean (value);
 
39
        if (prop_val != client->priv->lid_is_closed) {
 
40
-               client->priv->lid_is_closed = ret;
 
41
+               client->priv->lid_is_closed = prop_val;
 
42
                g_object_notify (G_OBJECT(client), "lid-is-closed");
 
43
        }
 
44
 
 
45
@@ -399,7 +399,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
46
        }
 
47
        prop_val = g_value_get_boolean (value);
 
48
        if (prop_val != client->priv->on_battery) {
 
49
-               client->priv->on_battery = ret;
 
50
+               client->priv->on_battery = prop_val;
 
51
                g_object_notify (G_OBJECT(client), "on-battery");
 
52
        }
 
53
 
 
54
@@ -410,7 +410,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
55
        }
 
56
        prop_val = g_value_get_boolean (value);
 
57
        if (prop_val != client->priv->on_low_battery) {
 
58
-               client->priv->on_low_battery = ret;
 
59
+               client->priv->on_low_battery = prop_val;
 
60
                g_object_notify (G_OBJECT(client), "on-low-battery");
 
61
        }
 
62
 
 
63
@@ -421,7 +421,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
64
        }
 
65
        prop_val = g_value_get_boolean (value);
 
66
        if (prop_val != client->priv->lid_is_present) {
 
67
-               client->priv->lid_is_present = ret;
 
68
+               client->priv->lid_is_present = prop_val;
 
69
                g_object_notify (G_OBJECT(client), "lid-is-present");
 
70
        }
 
71
 
 
72
@@ -431,8 +431,8 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
73
                goto out;
 
74
        }
 
75
        prop_val = g_value_get_boolean (value);
 
76
-       if (ret != client->priv->is_docked) {
 
77
-               client->priv->is_docked = ret;
 
78
+       if (prop_val != client->priv->is_docked) {
 
79
+               client->priv->is_docked = prop_val;
 
80
                g_object_notify (G_OBJECT(client), "is-docked");
 
81
        }
 
82
 
 
83
@@ -443,7 +443,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
 
84
        }
 
85
        prop_val = g_value_get_boolean (value);
 
86
        if (prop_val != client->priv->lid_force_sleep) {
 
87
-               client->priv->lid_force_sleep = ret;
 
88
+               client->priv->lid_force_sleep = prop_val;
 
89
                g_object_notify (G_OBJECT(client), "lid-force-sleep");
 
90
        }
 
91
 
 
92
-- 
 
93
1.8.3.2
 
94