From 56d42e9356ab1367d55026331f676aa687a148ab Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Fri, 13 Nov 1998 02:59:12 +0000 Subject: [PATCH] Fixed outbound/inbound mixup for traversing the arcs in Open(). Fixed some bugs in Open() for adding kids to a node. --- rdf/src/nsRDFDataModelItem.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rdf/src/nsRDFDataModelItem.cpp b/rdf/src/nsRDFDataModelItem.cpp index faf241519c0..025c16e999b 100644 --- a/rdf/src/nsRDFDataModelItem.cpp +++ b/rdf/src/nsRDFDataModelItem.cpp @@ -201,8 +201,8 @@ nsRDFDataModelItem::Open(void) RDF_Cursor cursor; if (mDataModel.GetArcType() == eRDFArcType_Outbound) { // Arcs are outbound, that is, from a parent to it's - // child. Find all arcs whose source is "me". - cursor = RDF_GetSources(mDataModel.GetDB(), + // child. Find all targets whose source is "me". + cursor = RDF_GetTargets(mDataModel.GetDB(), GetResource(), mDataModel.GetArcProperty(), RDF_RESOURCE_TYPE, @@ -210,8 +210,8 @@ nsRDFDataModelItem::Open(void) } else { // Arcs are inbound, that is, from a child to it's - // parent. Find all arcs whose target is "me". - cursor = RDF_GetTargets(mDataModel.GetDB(), + // parent. Find all sources whose target is "me". + cursor = RDF_GetSources(mDataModel.GetDB(), GetResource(), mDataModel.GetArcProperty(), RDF_RESOURCE_TYPE, @@ -219,14 +219,15 @@ nsRDFDataModelItem::Open(void) } if (cursor) { - PRUint32 index = 0; RDF_Resource r; while ((r = static_cast(RDF_NextValue(cursor))) != NULL) { nsRDFDataModelItem* child; if (NS_FAILED(mDataModel.CreateItem(r, child))) continue; - mChildren[index++] = child; + // CreateItem() will have done an AddRef(), like a good + // COM citizen... + mChildren.Add(child); child->mParent = this; } RDF_DisposeCursor(cursor);