orocos-toolchain / ocl

Orocos Component Library
Other
16 stars 33 forks source link

lua: fixed cleanup of TaskContexts with the tc_cleanup function #47

Closed meyerj closed 8 years ago

meyerj commented 8 years ago

Attributes are owned by the TaskContext and TaskContext::removeAttribute() or the respective Lua wrapper already destroys the instance returned by TaskContext::getAttribute(). The additional attr:delete() command triggers a segfault if the component has at least one attribute. The implementation of attributes is different from ports and properties with that respect, which are not cloned when they are added to the component interface.

On the other hand while adding attributes the instance created by Lua in Attribute_new() should be destroyed after it has been cloned and added to the TaskContext or TaskContext_addAttribute() must exchange the instance pointer in the Lua stack with the clone (not sure if this is possible).