From c1d44f048af29b8cf0c7dbdb82245ad8b0b6b6ab Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Thu, 7 Feb 2013 09:33:19 -0800 Subject: [PATCH] fixed crasher --- lib/abstractpropertytype.cpp | 12 +++++++----- lib/abstractpropertytype.h | 2 +- lib/debugout.h | 1 + lib/vehicleproperty.cpp | 2 +- plugins/dbus/abstractdbusinterface.cpp | 5 ++--- plugins/dbus/varianttype.cpp | 11 +++++++++-- plugins/dbus/vehicleinfo.h | 2 +- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lib/abstractpropertytype.cpp b/lib/abstractpropertytype.cpp index d964d67..42e2a20 100644 --- a/lib/abstractpropertytype.cpp +++ b/lib/abstractpropertytype.cpp @@ -12,9 +12,9 @@ ListPropertyType::ListPropertyType() } -ListPropertyType::ListPropertyType(int) +ListPropertyType::ListPropertyType(AbstractPropertyType *property) { - + append(property); } ListPropertyType::ListPropertyType(ListPropertyType &other) @@ -74,15 +74,17 @@ void ListPropertyType::fromString(std::string) GVariant *ListPropertyType::toVariant() { GVariantBuilder params; - g_variant_builder_init(¶ms,G_VARIANT_TYPE_ARRAY); + g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY); for(auto itr = mList.begin(); itr != mList.end(); itr++) { - AbstractPropertyType* t; + AbstractPropertyType* t = *itr; g_variant_builder_add_value(¶ms, t->toVariant()); } - return g_variant_builder_end(¶ms); + GVariant* var = g_variant_builder_end(¶ms); + g_assert(var); + return var; } diff --git a/lib/abstractpropertytype.h b/lib/abstractpropertytype.h index 67c63a9..9ed7cf5 100644 --- a/lib/abstractpropertytype.h +++ b/lib/abstractpropertytype.h @@ -367,7 +367,7 @@ class ListPropertyType: public AbstractPropertyType public: ListPropertyType(); - ListPropertyType(int unused); + ListPropertyType(AbstractPropertyType *property); ListPropertyType(ListPropertyType & other); ~ListPropertyType(); diff --git a/lib/debugout.h b/lib/debugout.h index 8a0af60..6fbc690 100644 --- a/lib/debugout.h +++ b/lib/debugout.h @@ -101,6 +101,7 @@ private: std::string bufferTime(double time) { ostringstream f; + f.precision(15); f< d(0); return new DoorsPerRowType(&d); }); REGISTERPROPERTY(TransmissionGearType,Transmission::Unknown); REGISTERPROPERTYWITHTYPE(FrontWheelRadius, WheelRadiusType, 0); REGISTERPROPERTYWITHTYPE(RearWheelRadius, WheelRadiusType, 0); diff --git a/plugins/dbus/abstractdbusinterface.cpp b/plugins/dbus/abstractdbusinterface.cpp index 88a02b1..789af5a 100644 --- a/plugins/dbus/abstractdbusinterface.cpp +++ b/plugins/dbus/abstractdbusinterface.cpp @@ -134,14 +134,13 @@ void AbstractDBusInterface::updateValue(AbstractProperty *property) g_dbus_connection_emit_signal(mConnection, NULL, mObjectPath.c_str(), mInterfaceName.c_str(), string(property->name() + "Changed").c_str(), tuple_variant, &error); - //g_variant_unref(params[0]); - //g_variant_unref(params[1]); g_free(params); g_variant_unref(val); if(error) { - throw -1; + DebugOut(0)<message<toVariant(); + auto v = value(); + + return v->toVariant(); } void VariantType::fromGVariant(GVariant *val) @@ -42,6 +44,11 @@ void VariantType::fromGVariant(GVariant *val) request.value = v; request.completed = [](AsyncPropertyReply* reply) { + /// TODO: throw dbus exception + if(!reply->success) + { + DebugOut(0)<<"Success fail"; + } delete reply; }; diff --git a/plugins/dbus/vehicleinfo.h b/plugins/dbus/vehicleinfo.h index 87bb8a7..a5e3314 100644 --- a/plugins/dbus/vehicleinfo.h +++ b/plugins/dbus/vehicleinfo.h @@ -66,7 +66,7 @@ public: DoorsProperty(AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("org.automotive.doors","/org/automotive/vehicleinfo/doors", re, connection, map()) { - wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", "a(i)", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", "ai", AbstractProperty::Read); supportedChanged(re->supported()); } -- 2.7.4