Merge lp:~charlesk/indicator-sound/lp-1244468 into lp:indicator-sound/14.04

Proposed by Charles Kerr
Status: Merged
Approved by: Lars Karlitski
Approved revision: 396
Merged at revision: 395
Proposed branch: lp:~charlesk/indicator-sound/lp-1244468
Merge into: lp:indicator-sound/14.04
Diff against target: 58 lines (+7/-7)
1 file modified
src/service.vala (+7/-7)
To merge this branch: bzr merge lp:~charlesk/indicator-sound/lp-1244468
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+192610@code.launchpad.net

Description of the change

In Service's volume_changed() function, explicitly instantiate the GVariant to avoid leaking it. See the description in bug #1244468 for before & after C code and more information.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
396. By Charles Kerr

fix similar variant leaks

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lars Karlitski (larsu) wrote :

Workaroundy, but looks fine to me. Nice find!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/service.vala'
2--- src/service.vala 2013-10-24 19:48:08 +0000
3+++ src/service.vala 2013-10-25 00:24:36 +0000
4@@ -175,10 +175,10 @@
5 }
6
7 Action create_mute_action () {
8- var mute_action = new SimpleAction.stateful ("mute", null, this.volume_control.mute);
9+ var mute_action = new SimpleAction.stateful ("mute", null, new Variant.boolean (this.volume_control.mute));
10
11 mute_action.activate.connect ( (action, param) => {
12- action.change_state (!action.get_state ().get_boolean ());
13+ action.change_state (new Variant.boolean (!action.get_state ().get_boolean ()));
14 });
15
16 mute_action.change_state.connect ( (action, val) => {
17@@ -186,7 +186,7 @@
18 });
19
20 this.volume_control.notify["mute"].connect ( () => {
21- mute_action.set_state (this.volume_control.mute);
22+ mute_action.set_state (new Variant.boolean (this.volume_control.mute));
23 this.update_root_icon ();
24 });
25
26@@ -195,13 +195,13 @@
27
28 void volume_changed (double volume) {
29 var volume_action = this.actions.lookup_action ("volume") as SimpleAction;
30- volume_action.set_state (volume);
31+ volume_action.set_state (new Variant.double (volume));
32
33 this.update_root_icon ();
34 }
35
36 Action create_volume_action () {
37- var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, this.volume_control.get_volume ());
38+ var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, new Variant.double (this.volume_control.get_volume ()));
39
40 volume_action.change_state.connect ( (action, val) => {
41 volume_control.set_volume (val.get_double ());
42@@ -221,14 +221,14 @@
43 }
44
45 Action create_mic_volume_action () {
46- var volume_action = new SimpleAction.stateful ("mic-volume", null, this.volume_control.get_mic_volume ());
47+ var volume_action = new SimpleAction.stateful ("mic-volume", null, new Variant.double (this.volume_control.get_mic_volume ()));
48
49 volume_action.change_state.connect ( (action, val) => {
50 volume_control.set_mic_volume (val.get_double ());
51 });
52
53 this.volume_control.mic_volume_changed.connect ( (volume) => {
54- volume_action.set_state (volume);
55+ volume_action.set_state (new Variant.double (volume));
56 });
57
58 this.volume_control.bind_property ("ready", volume_action, "enabled", BindingFlags.SYNC_CREATE);

Subscribers

People subscribed via source and target branches