I've recently had to fix a problem in the SDO for PHP code where the user was holding a reference to a DataObjectList, the containing DataObject was dropped, and the list went eerily empty.

Example:
DataObjectPtr dop = xmlDocumentPtr->getRootDataObject();
DataObjectList& dol = dop->getList(propertyName);
/* print the list - it's populated */
dop = NULL;
/* print the list - it's now empty */

I fixed this by making the PHP wrapper for the list also hold a reference to the containing DataObject, so that it will not be freed whilst the user is working on the list.

I think this is Working As Designed according to the specification, and it was just my carelessness in assuming that a DataObjectList is reference-counted in the same way as a DataObject. But I'm inclined to see this as a spec issue - I don't see why DataObjectLists would behave differently from DataObjects, and it makes the API quite confusing. What's the rationale for this?

A related issue is that I don't see a (public) way to reach the containing DataObject from a DataObjectList. Did I miss something?



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to