fixed dbus plugin not to use the temp pointer
authorKevron Rees <tripzero.kev@gmail.com>
Wed, 29 Aug 2012 01:47:51 +0000 (18:47 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Wed, 29 Aug 2012 01:47:51 +0000 (18:47 -0700)
lib/abstractpropertytype.h
plugins/dbus/abstractproperty.h
plugins/dbus/dbusplugin.cpp

index b4e8118..f56cb6b 100644 (file)
@@ -41,6 +41,11 @@ public:
                return boost::any_cast<T>(mValue);
        }
 
+       boost::any anyValue()
+       {
+               return mValue;
+       }
+
 protected:
 
        boost::any mValue;
index 65834b0..f2254d3 100644 (file)
@@ -69,7 +69,7 @@ public:
        virtual GVariant* toGVariant() = 0;
        virtual void fromGVariant(GVariant *value) = 0;
 
-       void setValue(AbstractPropertyType* val)
+       void setValue(boost::any val)
        {
                mValue = val;
                updateValue();
@@ -85,7 +85,7 @@ public:
        template<typename T>
        T value()
        {
-               return mValue->value<T>();
+               return boost::any_cast<T>(mValue);
        }
        
 protected: ///methods:
@@ -94,7 +94,7 @@ protected: ///methods:
        
 protected:
        
-       AbstractPropertyType * mValue;
+       boost::any mValue;
        string mPropertyName;
        string mSignature;
        SetterFunc mSetterFunc;
index 3625340..b33ee56 100644 (file)
@@ -58,7 +58,7 @@ void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPrope
                return;
 
        AbstractProperty* prop = propertyDBusMap[property];
-       prop->setValue(value);
+       prop->setValue(value->anyValue());
 }
 
 std::string DBusSink::uuid()