Merge lp:~renatofilho/buteo-syncfw/fix-1509053 into lp:~phablet-team/buteo-syncfw/ubuntu

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Ken VanDine
Approved revision: 283
Merged at revision: 282
Proposed branch: lp:~renatofilho/buteo-syncfw/fix-1509053
Merge into: lp:~phablet-team/buteo-syncfw/ubuntu
Diff against target: 62 lines (+50/-0)
2 files modified
debian/patches/0004-Fixed-OOP-plugin-initialization.patch (+49/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~renatofilho/buteo-syncfw/fix-1509053
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+275453@code.launchpad.net

Commit message

Fixed OOP plugin initialization.

Wait until the OOP plugin service appear on DBUS, to continue plugin initialization.

To post a comment you must log in.
283. By Renato Araujo Oliveira Filho

Updated patch based on upstream comments.

Revision history for this message
Ken VanDine (ken-vandine) wrote :

packaging is fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'debian/patches/0004-Fixed-OOP-plugin-initialization.patch'
2--- debian/patches/0004-Fixed-OOP-plugin-initialization.patch 1970-01-01 00:00:00 +0000
3+++ debian/patches/0004-Fixed-OOP-plugin-initialization.patch 2015-10-28 11:57:36 +0000
4@@ -0,0 +1,49 @@
5+diff --git a/libbuteosyncfw/pluginmgr/PluginManager.cpp b/libbuteosyncfw/pluginmgr/PluginManager.cpp
6+index c66f537..b4a0cb8 100644
7+--- a/libbuteosyncfw/pluginmgr/PluginManager.cpp
8++++ b/libbuteosyncfw/pluginmgr/PluginManager.cpp
9+@@ -658,13 +658,30 @@ QProcess* PluginManager::startOOPPlugin( const QString &aPath,
10+ process->setProcessChannelMode( QProcess::ForwardedChannels );
11+ process->start( aPath, args );
12+
13+- // This check is a workaround for the bug https://codereview.qt-project.org/#change,62897
14+- QThread::sleep(1); // The process state does not seem be in a proper state immediately
15++ const QString clientPluginDBusServiceName(QStringLiteral("com.buteo.msyncd.plugin.profile-%1").arg(aProfileName));
16++ const QString serverPluginDBusServiceName(QStringLiteral("com.buteo.msyncd.plugin.%1").arg(aProfileName));
17++ bool pluginHasRegistered = false;
18++ for (int i = 0; i < 30; i++) { // wait for up to thirty seconds for the process to register with dbus
19++ QThread::sleep(1); // sleep for a second to wait for the process to be scheduled, init and register with dbus
20++ QDBusReply<bool> clientServiceRegistered = QDBusConnection::sessionBus().interface()->isServiceRegistered(clientPluginDBusServiceName);
21++ if (clientServiceRegistered.isValid() && clientServiceRegistered.value()) {
22++ pluginHasRegistered = true;
23++ break;
24++ }
25++ QDBusReply<bool> serverServiceRegistered = QDBusConnection::sessionBus().interface()->isServiceRegistered(serverPluginDBusServiceName);
26++ if (serverServiceRegistered.isValid() && serverServiceRegistered.value()) {
27++ pluginHasRegistered = true;
28++ break;
29++ }
30++ }
31++
32+ if( process->state() == QProcess::Starting ) {
33+ started = process->waitForStarted();
34++ } else {
35++ started = process->state() == QProcess::Running;
36+ }
37+
38+- if (started == true) {
39++ if (started) {
40+ DllInfo info;
41+ info.iPath = aPath;
42+ info.iHandle = (void*)process;
43+@@ -675,6 +692,10 @@ QProcess* PluginManager::startOOPPlugin( const QString &aPath,
44+ iDllLock.unlock();
45+
46+ LOG_DEBUG( "Process " << process->program() << " started with pid " << process->pid() );
47++ if (!pluginHasRegistered) {
48++ LOG_DEBUG( "Process " << process->program() << " with pid " << process->pid() <<
49++ "was unable to register DBus service: " << clientPluginDBusServiceName << "|" << serverPluginDBusServiceName );
50++ }
51+ connect(process, SIGNAL(finished(int,QProcess::ExitStatus)),
52+ this, SLOT(onProcessFinished(int,QProcess::ExitStatus)));
53+ return process;
54
55=== modified file 'debian/patches/series'
56--- debian/patches/series 2015-09-22 16:15:11 +0000
57+++ debian/patches/series 2015-10-28 11:57:36 +0000
58@@ -3,3 +3,4 @@
59 0002-Fixed-FUNCTION_CALL_TRACE-macro.patch
60 0003-Added-upstart-service-file.patch
61 0001-Check-for-WLAN-or-ETHERNET-connections.patch
62+0004-Fixed-OOP-plugin-initialization.patch

Subscribers

People subscribed via source and target branches