You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Caroline Maynard <ce...@php.net> on 2007/05/01 14:46:19 UTC

[SDO C++] SDOList is not reference-counted

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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org