orocos-toolchain/rtt — pull request #23 by meyerj (2014-02-13 13:51:36+00:00)
Title: Fixed handling of owned properties in PropertyBag's assignment operator

The assignment operator of `PropertyBag` is not cloning the owned properties of the source. This can result in segfaults if the source bag has been destroyed or cleared:

```cpp
RTT::PropertyBag source;
double value;
source.addProperty("d", "A double property", value); // adds a new owned property with a reference to value
RTT::PropertyBag target = source; // note: RTT::PropertyBag target(source) would clone the property
source.clear(); // deletes all owned properties
target.getPropertyType("d")->set(0.5); // SEGFAULT!
```

This patch makes sure that the result of copying a bag using the copy constructor and using the assignment operator is the same. I am not sure if this would break existing code or marshalling, as updating cloned properties in the target bag has no effect on the source bag anymore, while for "normal" properties it has. At least the current RTT tests pass successfully.

The only solution I can think off that assures the "a PropertyBag is a container with references to properties" semantics is to introduce reference counters for properties or rewrite the `PropertyBag` class with shared pointers in connection with the [null_deleter technique](http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#static).