[xsd-users] Possible bug 2

Barrie Kovish barrie.kovish at singularsoftware.com
Sun May 29 11:44:59 EDT 2011


I believe I have found a bug similar to a previous bug (see mailing list Aug 31, 2010 subject "Possible bug").
Here is a snippet of my code which generates the problem:

	  
	// pHouse1 and pHouse2 point to Code Synthesis generated objects.
	assert( NULL != pHouse1 );
	assert( NULL != pHouse1->_root());
	assert( NULL != pHouse2 );
	assert( NULL != pHouse2->_root());

	house::room_sequence * pRooms = pHouse1->room();
	assert( NULL != pRooms );
        assert( 2 == pRooms->size());

	house::room_sequence * pRoomsCheck = pHouse2->room();
	assert( NULL != pRoomsCheck );
        assert( 0 == pRoomsCheck->size());


	// The pRooms sequence will replace the pRoomsCheck sequence.  
        // Since they have different sizes they are not the same and since pRoomsCheck is empty
        // they do not share content. 
	pHouse2->room( pRooms );


The failure occurs in the same spot as before:

File: 	elements.hxx  (patched from 2010-09-01)
Struct:	dom_element_info: public dom_info
Method:	virtual std::auto_ptr<dom_info> clone (type& tree_node, container* c) const
Line: 	807
Code:	assert (dn->getNodeType () == DOMNode::ELEMENT_NODE);

In this case as the previous one dn is NULL.  As in the pervious case it appears 
that

              // Move in parallel until we get to the needed node.
              //
              for (; sn != 0 && !e_.isSameNode (sn);)
              {
                sn = sn->getNextSibling ();
                dn = dn->getNextSibling ();
              }

e_ is equal to sn and the loop contents are not executed and hence dn is never set.

This bug causes our code to crash on some common conditions so we really need a fix.

Thanks,

Barrie



More information about the xsd-users mailing list