I?ve noticed that the C SDK generally destroys payloads as soon as it can. For 
instance when you pass in a payload to OCDoResource, it?s destroyed at the end 
of the call. Or when I get a discovery payload back, it?s destroyed immediately 
after the callback of the discovery. In the latter case I might want to perform 
an asynchronous get of the resource?s properties, but after that point the 
discovery payload has been destroyed and I now have a dangling useless pointer 
(and there?s no method for cloning the discovery payload as a workaround).

I?m really confused why there?s a bunch of destroy methods in the C-SDK, but it 
seems it is taking over destroying resources for me before I had a chance to be 
done with them.

Is there a way to take back control of references that I pass in, or get as an 
output? If I create them, or get them as a result, I should be in charge of 
their lifecycle. Without it, it makes it completely unpredictable when a handle 
is still valid or not. Generally I would want my higher-level container classes 
to destroy the CSDK references when they go out of scope, but I have no clue if 
they have already been destroyed by the C SDK ? it really depends on whether 
they have been used as input to a method at some point, or was a return value 
from a callback.


Thanks
/Morten

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20161218/484dbff8/attachment.html>

Reply via email to