December 21st, 2012, 09:19 AM
IUnknown pointer error, exception
I need to read an XML file which holds input data for a Service into a DOM tree. The main process initilizes everything and sets the start data and a update thread need to check for changes in the XML file and should update the DOM tree.
I setup an event to prevent conflicts during access of the DOM tree. The program runs fine, I get all my data out of the DOM as expected, but my problem is now, that after the 3rd run of the Update Thread, the IUnknown pointer of the m_docPtr is invalid and when triing to use it I will get an exception. I reduced the code and just put an QueryInterface in the routine which should normally update the DOM tree and still I have the same problem.
So I don't use the pointer at all no more just for QueryInterface in the update routine and I still have a invalid IUnknown pointer inside of the m_docPtr.
The m_docPtr is a member in a class which is passed to the thread. I tried both pointers MSXML2 and COM, async and sync access, msxml3 and msxml6 docs, since msxml3 throws according to microsoft an exception during heavy traffic.
But I still get the same result after the update thread runs the 3rd time the pointer is invalid and throws an exception when I use the m_docPtr
//MSXML2::IXMLDOMDocumentPtr m_docPtr;//pointer to DOMDocument object
Main calls Init in the Process in main Thread which runs till the Service is terminated
varResult = m_docPtr->load(m_varSrcFile);
Trace(ERROR,"CmyDOM: failed to load XML file. Check the file name." );
DWORD WINAPI UpdateDDTThread (LPVOID lpParameter)
CmyDOM *pmyDOM = (CmyDOM *)lpParameter;
while (CmyDOM->UpdateThreadCmd != TS_STOPPED)
Does anyone can help me with this. What is the proper way to update a DOM tree when the input XML file is changed?
Thank you in advance.
Click Here to Expand Forum to Full Width