Merge lp:~ted/appmenu-gtk/unref-if-non-null into lp:appmenu-gtk/0.4

Proposed by Ted Gould
Status: Merged
Merged at revision: 113
Proposed branch: lp:~ted/appmenu-gtk/unref-if-non-null
Merge into: lp:appmenu-gtk/0.4
Diff against target: 17 lines (+6/-1)
1 file modified
src/bridge.c (+6/-1)
To merge this branch: bzr merge lp:~ted/appmenu-gtk/unref-if-non-null
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+48794@code.launchpad.net

Description of the change

Don't unref the variant if it's NULL (usually error)

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bridge.c'
2--- src/bridge.c 2011-02-03 13:56:08 +0000
3+++ src/bridge.c 2011-02-07 15:46:13 +0000
4@@ -288,7 +288,12 @@
5 AppWindowContext *context = (AppWindowContext *)user_data;
6
7 GVariant * variants = g_dbus_proxy_call_finish(G_DBUS_PROXY(object), res, &error);
8- g_variant_unref(variants);
9+
10+ if (variants != NULL) {
11+ /* Only unref variants if we get some. Doing this hear instead of
12+ with the error so that it's clear we don't use it. */
13+ g_variant_unref(variants);
14+ }
15
16 if (error != NULL)
17 {

Subscribers

People subscribed via source and target branches