summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevron Rees <kevron.m.rees@intel.com>2014-12-19 10:40:05 -0800
committerKevron Rees <kevron.m.rees@intel.com>2014-12-23 13:07:49 -0800
commitef0d98986ca55fc87ce1138b4223416eb29173ee (patch)
tree726dcdf6835fda2eb94442e0822207dfae2f31a2
parent429056a570f61b0a6a2653feb913f7138836dcc6 (diff)
downloadautomotive-message-broker-ef0d98986ca55fc87ce1138b4223416eb29173ee.tar.gz
use unique pointers for memory management
-rw-r--r--lib/abstractpropertytype.h4
-rw-r--r--plugins/dbus/varianttype.cpp10
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/abstractpropertytype.h b/lib/abstractpropertytype.h
index 7835b892..1d299bbc 100644
--- a/lib/abstractpropertytype.h
+++ b/lib/abstractpropertytype.h
@@ -282,7 +282,9 @@ public:
static int value(GVariant* v)
{
- return g_variant_get_int32(v);
+ int val = 0;
+ g_variant_get(v, signature(), &val);
+ return val;
}
static std::string stringize(std::string v)
diff --git a/plugins/dbus/varianttype.cpp b/plugins/dbus/varianttype.cpp
index 6af9d03d..4f3bce82 100644
--- a/plugins/dbus/varianttype.cpp
+++ b/plugins/dbus/varianttype.cpp
@@ -21,16 +21,15 @@ void VariantType::initialize()
request.zoneFilter = mZoneFilter;
using namespace std::placeholders;
- request.completed = [this](AsyncPropertyReply* reply)
+ request.completed = [this](AsyncPropertyReply* r)
{
+ auto reply = amb::make_unique(r);
if(reply->success)
setValue(reply->value->copy());
else
DebugOut(DebugOut::Error)<<"get request unsuccessful for "<<reply->property<<" : "<<reply->error<<endl;
mInitialized = true;
-
- delete reply;
};
/// do not request if not supported:
@@ -61,15 +60,14 @@ void VariantType::fromGVariant(GVariant *val)
request.property = mAmbPropertyName;
request.value = v;
request.zoneFilter = mZoneFilter;
- request.completed = [&](AsyncPropertyReply* reply)
+ request.completed = [&](AsyncPropertyReply* r)
{
+ auto reply = amb::make_unique(r);
/// TODO: throw dbus exception
if(!reply->success)
{
DebugOut(DebugOut::Error)<<"SetProperty fail: "<<reply->error<<endl;
}
-
- delete reply;
};
routingEngine->setProperty(request);