3

Certain functions in my program get a bad pointer with a low probability.

The pointer is the CComPtr <IHTMLDocument2> m_htmldocument2 variable.

Moving the m_htmldocument2 variable to a local variable causes an access violation error if m_htmldocument2 is not a valid value.

I did not have a way to check if m_htmldocument2 was a valid value, and tried to process it as __try __except, but I could not do it because there was a destructor.

Is there a safe way to move to a local variables?

StoryTeller - Unslander Monica
  • 165,132
  • 21
  • 377
  • 458
i like cat
  • 135
  • 8
  • `CComPtr m_htmldocument2` is only a declaration, declaring it on stack will not cause random errors. COM has plenty of error checking. It's not known what you are doing that's causing an error. – Barmak Shemirani Nov 14 '17 at 10:02

0 Answers0