Merge lp:~robert-ancell/activity-log-manager/proxy-unref into lp:activity-log-manager

Proposed by Robert Ancell
Status: Merged
Merge reported by: Robert Ancell
Merged at revision: not available
Proposed branch: lp:~robert-ancell/activity-log-manager/proxy-unref
Merge into: lp:activity-log-manager
Diff against target: 111 lines (+22/-13)
1 file modified
src/diagnostics-widget.c (+22/-13)
To merge this branch: bzr merge lp:~robert-ancell/activity-log-manager/proxy-unref
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Activity Log Manager Pending
Review via email: mp+204489@code.launchpad.net

Commit message

Destroy DBus proxy when preferences widget is destroyed

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/diagnostics-widget.c'
2--- src/diagnostics-widget.c 2013-07-19 10:31:55 +0000
3+++ src/diagnostics-widget.c 2014-02-03 13:48:17 +0000
4@@ -8,8 +8,6 @@
5
6 #include "whoopsie-preferences/libwhoopsie-preferences.h"
7
8-static WhoopsiePreferences* proxy = NULL;
9-
10 #define POL_PATH "com.ubuntu.whoopsiepreferences.change"
11 #define PRIVACY_URL "http://www.ubuntu.com/aboutus/privacypolicy?crashdb"
12 #define SYSTEM_ERRORS_URL "https://errors.ubuntu.com/user"
13@@ -31,6 +29,7 @@
14 {
15 GtkBuilder* builder;
16 GPermission* permission;
17+ WhoopsiePreferences* proxy;
18 };
19
20 struct _WhoopsieDaisyPreferences
21@@ -59,6 +58,10 @@
22 g_object_unref (priv->permission);
23 priv->permission = NULL;
24 }
25+ if (priv->proxy) {
26+ g_object_unref (priv->proxy);
27+ priv->proxy = NULL;
28+ }
29 }
30
31 static void
32@@ -79,10 +82,12 @@
33 static void
34 on_show_previous_reports_clicked (GtkWidget* button, gpointer user_data)
35 {
36+ WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (user_data)->priv;
37 GError* error = NULL;
38 gchar* identifier = NULL;
39 gchar* command = NULL;
40- whoopsie_preferences_call_get_identifier_sync (proxy, &identifier, NULL, &error);
41+
42+ whoopsie_preferences_call_get_identifier_sync (priv->proxy, &identifier, NULL, &error);
43
44 if (!error) {
45 asprintf (&command, "xdg-open " SYSTEM_ERRORS_URL "/%s", identifier);
46@@ -117,9 +122,10 @@
47 static void
48 on_submit_error_reports_checked (GtkToggleButton* button, gpointer user_data)
49 {
50+ WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (user_data)->priv;
51 GError* error = NULL;
52
53- whoopsie_preferences_call_set_report_crashes_sync (proxy,
54+ whoopsie_preferences_call_set_report_crashes_sync (priv->proxy,
55 gtk_toggle_button_get_active (button), NULL, &error);
56 if (error != NULL) {
57 g_printerr ("Error setting crash reporting: %s\n", error->message);
58@@ -130,9 +136,10 @@
59 static void
60 on_submit_metrics_reports_checked (GtkToggleButton* button, gpointer user_data)
61 {
62+ WhoopsieDaisyPreferencesPrivate* priv = WHOOPSIE_DAISY_PREFERENCES (user_data)->priv;
63 GError* error = NULL;
64
65- whoopsie_preferences_call_set_report_metrics_sync (proxy,
66+ whoopsie_preferences_call_set_report_metrics_sync (priv->proxy,
67 gtk_toggle_button_get_active (button), NULL, &error);
68 if (error != NULL) {
69 g_printerr ("Error setting metrics reporting: %s\n", error->message);
70@@ -166,17 +173,19 @@
71 static void
72 whoopsie_daisy_preferences_setup_dbus (WhoopsieDaisyPreferences *self, GError *error)
73 {
74- proxy = whoopsie_preferences_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
75+ WhoopsieDaisyPreferencesPrivate* priv = self->priv;
76+
77+ priv->proxy = whoopsie_preferences_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
78 G_DBUS_PROXY_FLAGS_NONE,
79 "com.ubuntu.WhoopsiePreferences",
80 "/com/ubuntu/WhoopsiePreferences",
81 NULL, &error);
82- if (!proxy)
83+ if (!priv->proxy)
84 return;
85
86- g_signal_connect (proxy, "g-properties-changed",
87+ g_signal_connect (priv->proxy, "g-properties-changed",
88 G_CALLBACK (on_properties_changed), self);
89- on_properties_changed (proxy, NULL, NULL, self);
90+ on_properties_changed (priv->proxy, NULL, NULL, self);
91 }
92 static void
93 whoopsie_daisy_preferences_init (WhoopsieDaisyPreferences *self)
94@@ -237,13 +246,13 @@
95 }
96
97 g_signal_connect (submit_error_reports, "toggled",
98- G_CALLBACK (on_submit_error_reports_checked), NULL);
99+ G_CALLBACK (on_submit_error_reports_checked), self);
100 g_signal_connect (submit_metrics_reports, "toggled",
101- G_CALLBACK (on_submit_metrics_reports_checked), NULL);
102+ G_CALLBACK (on_submit_metrics_reports_checked), self);
103 g_signal_connect (privacy_policy, "clicked",
104- G_CALLBACK (on_privacy_policy_clicked), NULL);
105+ G_CALLBACK (on_privacy_policy_clicked), self);
106 g_signal_connect (show_previous_reports, "clicked",
107- G_CALLBACK (on_show_previous_reports_clicked), NULL);
108+ G_CALLBACK (on_show_previous_reports_clicked), self);
109 }
110
111 GtkWidget*

Subscribers

People subscribed via source and target branches