Merge lp:~ted/libdbusmenu/lp929707 into lp:libdbusmenu/0.6

Proposed by Ted Gould
Status: Merged
Approved by: Neil J. Patel
Approved revision: 363
Merged at revision: 369
Proposed branch: lp:~ted/libdbusmenu/lp929707
Merge into: lp:libdbusmenu/0.6
Diff against target: 54 lines (+17/-3)
1 file modified
libdbusmenu-glib/server.c (+17/-3)
To merge this branch: bzr merge lp:~ted/libdbusmenu/lp929707
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+92347@code.launchpad.net

Description of the change

Small fix to ensure the right ref count

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-glib/server.c'
2--- libdbusmenu-glib/server.c 2011-10-04 16:59:10 +0000
3+++ libdbusmenu-glib/server.c 2012-02-09 19:06:20 +0000
4@@ -990,6 +990,7 @@
5 /* these are going to be standard references in all code paths and must be unrefed */
6 GVariant * megadata[2];
7 gboolean gotsomething = FALSE;
8+ gboolean error_nosend = FALSE;
9
10 if (item_init) {
11 megadata[0] = g_variant_builder_end(&itembuilder);
12@@ -1002,6 +1003,10 @@
13 if (error != NULL) {
14 g_warning("Unable to parse '[ ]' as a 'a(ia{sv})': %s", error->message);
15 g_error_free(error);
16+ megadata[0] = NULL;
17+ error_nosend = TRUE;
18+ } else {
19+ g_variant_ref_sink(megadata[0]);
20 }
21 }
22
23@@ -1016,10 +1021,14 @@
24 if (error != NULL) {
25 g_warning("Unable to parse '[ ]' as a 'a(ias)': %s", error->message);
26 g_error_free(error);
27+ megadata[1] = NULL;
28+ error_nosend = TRUE;
29+ } else {
30+ g_variant_ref_sink(megadata[1]);
31 }
32 }
33
34- if (gotsomething && priv->dbusobject != NULL && priv->bus != NULL) {
35+ if (gotsomething && !error_nosend && priv->dbusobject != NULL && priv->bus != NULL) {
36 g_dbus_connection_emit_signal(priv->bus,
37 NULL,
38 priv->dbusobject,
39@@ -1029,8 +1038,13 @@
40 NULL);
41 }
42
43- g_variant_unref(megadata[0]);
44- g_variant_unref(megadata[1]);
45+ if (megadata[0] != NULL) {
46+ g_variant_unref(megadata[0]);
47+ }
48+
49+ if (megadata[1] != NULL) {
50+ g_variant_unref(megadata[1]);
51+ }
52
53 /* Clean everything up */
54 prop_array_teardown(priv->prop_array);

Subscribers

People subscribed via source and target branches

to all changes: