Outlook 2000 crashes when a plugin is multithreaded

  • Thread starter Thread starter Chuck Bohling
  • Start date Start date
C

Chuck Bohling

I have an Outlook plugin that uses multiple threads. I'm using the Outlook
Object Model to set some properties and then Save() them. This works fine
with Outlook 2003 but for 2000, when I do the Save(), Outlook crashes. Looks
like a NULL pointer dereference. Anyone have this problem before? Any reason
why Outlook can't do multithreaded plugins?
 
Outlook Object model is single threaded.
So you need to properly pass pointers between different threads.

Anyway all calls from different threads will be serialized
and fulfilled by main outlook thread.

WBR
Henry
 
I also had thread problems like Chuck with Outlook 2000. I solved it by
seperately getting an Outlook instance in each thread instead of passing
pointers between threads.

E.g. in C++ (at the start of each thread):

_ApplicationPtr spApp = NULL;

// get Outlook instance.

HRESULT hr = spApp.CreateInstance(_T("Outlook.Application"));

CreateInstance actually doesn't create a new instance each time, it simply
gets the existing one (that's how it works in my add-in anyway :) ).

Dieter
 
The result is the same if you pass pointers between threads using
CoMarshalInterThreadInterfaceInStream
CoGetInterfaceAndReleaseStream.

WBR
Henry
 
Back
Top