I have obviously some problems with referencing and need help:I have written an XML parser using the iDocument Interface. It implements the method ReadFile( registry, filename) which return a csRef<iDocument>. It opens a file, queries the iDocumentSystem, creates a csRef<iDocument> via CreateDocument(), opens an iFile and use the Parse() method.

To add more convinience, I implemented the ReadFile method twice. One version with the const char* filename and one with an iFile* as parameter.First one just opens a new iFile and return the result of the other one.

// here, gdb still shows for 'p xmldoc':// {<CS::Memory::CustomAllocated> = {<No data fields>}, obj = 0x6}// obj has not changed and is still the garbage

// so this check fails and xmldoc is considered as validif ( !xmldoc ){ printf("File Parsing not successfull\n");}

// Not really suprising, but here gdb still shows, that obj=0x6

csRef<iDocumentNode> root = xmldoc->GetRoot();// Boom! I get a segmentation fault

Within ReadFile, gdb shows a valid looking obj, and since I can access the nodes, I consider this as correct.

When I open the file in the main program via calling the other ReadFile(iFile*) version, it is working! So the two pass return seems to dump the reference.

I also increased the reference count manually, to test if this might be a problem, but I get the same result.

Since I work with recursions, I need to be sure, that references can be returned through two or more recursions. I hope I just handle csRef wrong and some casting and allocating or something els might fix it. But for the moment I have no ideaSo I probably handle them wrong.