summaryrefslogtreecommitdiff
path: root/UnityCore
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2015-09-30 18:32:38 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2015-09-30 18:32:38 +0200
commit9d44c249a58159c9dc5a93560dc0b116cf07f17d (patch)
tree0b781dac92d95d768664ef926b137e099bc2e3af /UnityCore
parent4058e44785e069cf916510d48cbb4cfe7e148f48 (diff)
TestGDBusProxy: make tests more robusts when using a cancellable
(bzr r4008.7.19)
Diffstat (limited to 'UnityCore')
-rw-r--r--UnityCore/GLibDBusProxy.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/UnityCore/GLibDBusProxy.cpp b/UnityCore/GLibDBusProxy.cpp
index fabef7d48..1cd6f4d3d 100644
--- a/UnityCore/GLibDBusProxy.cpp
+++ b/UnityCore/GLibDBusProxy.cpp
@@ -344,7 +344,8 @@ void DBusProxy::Impl::WaitForProxy(GCancellable* cancellable,
// wait for the signal
*con = proxy_acquired.connect([con, canc, timeout, callback] ()
{
- if (!g_cancellable_is_cancelled(canc)) callback(glib::Error());
+ if (!g_cancellable_is_cancelled(canc))
+ callback(glib::Error());
timeout->Remove();
con->disconnect();
@@ -390,12 +391,15 @@ void DBusProxy::Impl::Call(string const& method_name,
if (!proxy_)
{
glib::Variant sinked_parameters(parameters);
- glib::Object<GCancellable>canc(target_canc, glib::AddRef());
+ glib::Object<GCancellable> canc(target_canc, glib::AddRef());
+
WaitForProxy(canc, timeout_msec, [this, method_name, sinked_parameters, callback, canc, flags, timeout_msec] (glib::Error const& err)
{
if (err)
{
- callback(glib::Variant(), err);
+ if (callback)
+ callback(glib::Variant(), err);
+
LOG_WARNING(logger) << "Cannot call method " << method_name
<< ": " << err;
}