When should I free an inspector instance?

Y

Yaya.Rao

Hi,
I have an outlook addin written in VC++ for outlook 2003. I am freeing the
inspector instance and unadvising the events in the OnClose event. But, I
run into an AV in OUTLLIB.dll as soon as the OnClose event returns. OUTLLIB
is trying to access the freed inspector instance. Why is OUTLLIB trying to
access this freed inspector instance? Am I doing something wrong?

To work around this, I moved the cleanup of inspector instance to add-in app
quit event. But, since my addin doesn't unload until outlook quits, I will be
leaking these inspector instances.

Can you please advise on how to address this problem?

Thank you,
 
S

SvenC

Hi,
I have an outlook addin written in VC++ for outlook 2003. I am freeing
the inspector instance and unadvising the events in the OnClose event.
But, I run into an AV in OUTLLIB.dll as soon as the OnClose event
returns. OUTLLIB is trying to access the freed inspector instance. Why
is OUTLLIB trying to access this freed inspector instance? Am I doing
something wrong?

How do you free the instance? It is a reference counted COM object, so if
you call Release or maybe ReleaseComObject from .Net Outlook should still
have its own ref count which keeps the Inspector alive.
To work around this, I moved the cleanup of inspector instance to add-in
app quit event. But, since my addin doesn't unload until outlook quits,
I will be leaking these inspector instances.

I would expect that your cleanup code should work in the OnClose event. Just
give more details about how you free the Inspector.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top