Merge lp:~charlesk/libunity/lp-981309 into lp:libunity
Status: | Merged |
---|---|
Approved by: | Michal Hruby |
Approved revision: | 134 |
Merged at revision: | 134 |
Proposed branch: | lp:~charlesk/libunity/lp-981309 |
Merge into: | lp:libunity |
Diff against target: |
13 lines (+2/-1) 1 file modified
src/unity-launcher.vala (+2/-1) |
To merge this branch: | bzr merge lp:~charlesk/libunity/lp-981309 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michal Hruby (community) | Approve | ||
Review via email: mp+101998@code.launchpad.net |
Commit message
Plug a GHashTable leak in unity-launcher's serialize()
Description of the change
I'm still getting up to speed with Vala and am not sure whether or not this patch is The Right Fix.
Looking at the C code is useful: it looks like Vala's being confused by the implicit conversion of collect_
If we add a HashTable local (ie, HashTable foo = collect(); Variant bar = foo;) then vala's C code correctly adds a call to g_hash_
Here's the diff in valac's C code generated from that:
--- unity-launcher.
+++ unity-launcher.c 2012-04-13 20:11:06.453573302 -0500
@@ -603,6 +603,7 @@
UnityLauncher
GVariant* result = NULL;
GHashTable* _tmp0_ = NULL;
+ GHashTable* hash;
GVariant* _tmp5_;
GVariant* props;
const gchar* _tmp6_;
@@ -619,7 +620,8 @@
GVariant* _tmp15_;
self = (UnityLauncherE
_tmp0_ = unity_collect_
- _tmp5_ = _variant_new1 (_tmp0_);
+ hash = _tmp0_;
+ _tmp5_ = _variant_new1 (hash);
props = _tmp5_;
_tmp6_ = self->priv-
_tmp7_ = g_variant_
@@ -639,6 +641,7 @@
result = _tmp15_;
_g_variant_unref0 (_app_uri);
_g_variant_unref0 (props);
+ _g_hash_
return result;
}
Thanks Charles, yes this is the correct fix, we already saw a couple of instances of this. I checked with upstream Vala and they weren't aware of the issue, so it's now reported (bgo:674201).