Skip to main content
Known Participant
March 20, 2008
Question

XMLReference Boss Leak

  • March 20, 2008
  • 4 replies
  • 751 views
Hi list,<br /><br />I have encountered a strange problem concerning boss leaks when using XmlReference.<br /><br />Say i have a method called DoSomething() that looks like this:<br /><br />void DoSomething()<br />{<br /> InterfacePtr<IIDXMLElement> rootElement(Utils<IXMLUtils>()->QueryRootElement(doc));<br /> XMLReference rootRef = rootElement->GetXMLReference();<br />}<br /><br />When i execute this code and close my document i get no boss leak asserts.<br />However, if i create another method for re-use purposes i get boss leaks after closing the doc.<br /><br />XMLReference GetRootRef()<br />{<br /> InterfacePtr<IIDXMLElement> rootElement(Utils<IXMLUtils>()->QueryRootElement(doc));<br /> XMLReference rootRef = rootElement->GetXMLReference();<br /> return rootRef;<br />}<br /><br />void DoSomething()<br />{<br /> XMLReference rootRef = this->GetRootRef();<br />}<br /><br />The assert i get after closing the doc is:<br />"~InstanceList (): 7 oustanding references to UID 157. Class(kSBOSPageBoss)"<br /><br />Anyone knows what's causing this and how to resolve it?<br /><br />Thanks in advance,<br />Florian.
This topic has been closed for replies.

4 replies

Community Expert
August 25, 2011

The code you have shown seems to be correct and i even used it and it worked fine. So if you have this problem then the reason maybe some other code that might be using this code snippet that you have shown.

One thing that creates boss leaks and is farily common to miss is that we use "UseDefaultIID()" when getting an InterfacePtr from a method that returns a reference incremented pointer. So please have a look at this.

Manan Joshi

www.metadesignsolutions.com

-Manan
August 24, 2011

Is it (still) real?

The SDK example code use XMLReference like this, for instance SnpManipulateXMLElements with its functions GetDocumentElementRef() and GetRootElementRef().

Known Participant
August 27, 2008
Hi Rahul,

unfortunately, we have not been able to solve this yet. I hope someone notices this post again and can point us in the right direction.
If you should come across the solution, please let me now too.

Kind regards,
Florian.
August 25, 2008
Hi Florian,

Did you ever figure this out? We are having the same problem now.

Thanks,
Rahul