Merge lp:~vorlon/unity8/lp.1235649 into lp:unity8

Proposed by Steve Langasek
Status: Merged
Approved by: Thomas Voß
Approved revision: 434
Merge reported by: kevin gunn
Merged at revision: not available
Proposed branch: lp:~vorlon/unity8/lp.1235649
Merge into: lp:unity8
Diff against target: 88 lines (+20/-25)
2 files modified
plugins/Unity/Indicators/indicatorsmanager.cpp (+20/-24)
plugins/Unity/Indicators/indicatorsmanager.h (+0/-1)
To merge this branch: bzr merge lp:~vorlon/unity8/lp.1235649
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Thomas Voß (community) Approve
Review via email: mp+190443@code.launchpad.net

Commit message

Don't keep a long-lived connection open to upstart when we only use it for
two events, one at load time and one at unload time.

Description of the change

Fix handling of the upstart dbus connection in the indicator plugin: we do
not want to hold a socket open to upstart for the life of the process when
we only use it twice.

To post a comment you must log in.
Revision history for this message
Thomas Voß (thomas-voss) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:434
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~vorlon/unity8/lp.1235649/+merge/190443/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity8-ci/1354/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4909
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2789
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2220
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/377
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1354
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1354/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1353
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1087
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/784
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/784/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2791
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2791/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2323
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2356

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1354/rebuild

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 'plugins/Unity/Indicators/indicatorsmanager.cpp'
2--- plugins/Unity/Indicators/indicatorsmanager.cpp 2013-08-30 08:17:10 +0000
3+++ plugins/Unity/Indicators/indicatorsmanager.cpp 2013-10-10 18:05:08 +0000
4@@ -47,34 +47,13 @@
5 IndicatorsManager::IndicatorsManager(QObject* parent)
6 : QObject(parent)
7 , m_loaded(false)
8- , m_upstart(NULL)
9 {
10- auto upstartsession = qgetenv("UPSTART_SESSION");
11- if (!upstartsession.isNull()) {
12- DBusConnection * conn = NULL;
13- conn = dbus_connection_open(upstartsession.constData(), NULL);
14- if (conn != NULL) {
15- m_upstart = nih_dbus_proxy_new(NULL, conn,
16- NULL,
17- DBUS_PATH_UPSTART,
18- NULL, NULL);
19- dbus_connection_unref(conn);
20- }
21- }
22-
23- if (m_upstart != NULL) {
24- m_upstart->auto_start = FALSE;
25- }
26 }
27
28 IndicatorsManager::~IndicatorsManager()
29 {
30 unload();
31
32- if (m_upstart != NULL) {
33- nih_unref(m_upstart, NULL);
34- m_upstart = NULL;
35- }
36 }
37
38 void IndicatorsManager::load()
39@@ -235,17 +214,34 @@
40 m_loaded = loaded;
41 Q_EMIT loadedChanged(m_loaded);
42
43- if (m_upstart != NULL) {
44+ auto upstartsession = qgetenv("UPSTART_SESSION");
45+ NihDBusProxy * upstart = NULL;
46+
47+ if (!upstartsession.isNull()) {
48+ DBusConnection * conn = NULL;
49+ conn = dbus_connection_open(upstartsession.constData(), NULL);
50+ if (conn != NULL) {
51+ upstart = nih_dbus_proxy_new(NULL, conn,
52+ NULL,
53+ DBUS_PATH_UPSTART,
54+ NULL, NULL);
55+ dbus_connection_unref(conn);
56+ }
57+ }
58+
59+ if (upstart != NULL) {
60 int event_sent = 0;
61 if (m_loaded) {
62- event_sent = upstart_emit_event_sync(NULL, m_upstart, "indicator-services-start", NULL, 0);
63+ event_sent = upstart_emit_event_sync(NULL, upstart, "indicator-services-start", NULL, 0);
64 } else {
65- event_sent = upstart_emit_event_sync(NULL, m_upstart, "indicator-services-end", NULL, 0);
66+ event_sent = upstart_emit_event_sync(NULL, upstart, "indicator-services-end", NULL, 0);
67 }
68
69 if (event_sent != 0) {
70 qWarning() << "Unable to send indicator event to Upstart";
71 }
72+ nih_unref(upstart, NULL);
73+ upstart = NULL;
74 }
75 }
76 }
77
78=== modified file 'plugins/Unity/Indicators/indicatorsmanager.h'
79--- plugins/Unity/Indicators/indicatorsmanager.h 2013-08-07 16:10:35 +0000
80+++ plugins/Unity/Indicators/indicatorsmanager.h 2013-10-10 18:05:08 +0000
81@@ -71,7 +71,6 @@
82 QHash<QString, IndicatorData*> m_indicatorsData;
83 QSharedPointer<QFileSystemWatcher> m_fsWatcher;
84 bool m_loaded;
85- NihDBusProxy * m_upstart;
86 };
87
88 #endif // INDICATORS_MANAGER_H

Subscribers

People subscribed via source and target branches