Merge lp:~ted/libindicate/tuples-sucks into lp:libindicate/0.6

Proposed by Ted Gould
Status: Merged
Merged at revision: 403
Proposed branch: lp:~ted/libindicate/tuples-sucks
Merge into: lp:libindicate/0.6
Diff against target: 55 lines (+21/-10)
1 file modified
libindicate/server.c (+21/-10)
To merge this branch: bzr merge lp:~ted/libindicate/tuples-sucks
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+46361@code.launchpad.net

Description of the change

Fixing more crashers in libindicate

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libindicate/server.c'
2--- libindicate/server.c 2011-01-13 22:49:19 +0000
3+++ libindicate/server.c 2011-01-14 23:14:53 +0000
4@@ -1733,15 +1733,20 @@
5 g_dbus_method_invocation_return_gerror(invocation, error);
6 g_error_free(error);
7 } else {
8- GVariantBuilder builder;
9- g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
10-
11- int i;
12- for (i = 0; array != NULL && i < array->len; i++) {
13- g_variant_builder_add_value(&builder, g_variant_new_int32(g_array_index(array, gint, i)));
14+ GVariant * retval = NULL;
15+ if (array->len != 0) {
16+ GVariantBuilder builder;
17+ g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
18+
19+ int i;
20+ for (i = 0; array != NULL && i < array->len; i++) {
21+ g_variant_builder_add_value(&builder, g_variant_new_int32(g_array_index(array, gint, i)));
22+ }
23+
24+ retval = g_variant_builder_end(&builder);
25+ } else {
26+ retval = g_variant_parse(g_variant_type_new("ai"), "[]", NULL, NULL, NULL);
27 }
28-
29- GVariant * retval = g_variant_builder_end(&builder);
30 g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(&retval, 1));
31
32 g_array_free(array, TRUE);
33@@ -1808,7 +1813,10 @@
34 g_dbus_method_invocation_return_gerror(invocation, error);
35 g_error_free(error);
36 } else {
37- g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(&output, 1));
38+ if (output != NULL) {
39+ output = g_variant_new_tuple(&output, 1);
40+ }
41+ g_dbus_method_invocation_return_value(invocation, output);
42 }
43
44 return;
45@@ -1839,7 +1847,10 @@
46 g_error_free(error);
47 } else {
48 GVariant * retvals = g_variant_new_strv((const gchar * const *)props, -1);
49- g_dbus_method_invocation_return_value(invocation, g_variant_new_tuple(&retvals, 1));
50+ if (retvals != NULL) {
51+ retvals = g_variant_new_tuple(&retvals, 1);
52+ }
53+ g_dbus_method_invocation_return_value(invocation, retvals);
54 g_strfreev(props);
55 }
56

Subscribers

People subscribed via source and target branches

to all changes: