M
Martynas Kunigelis
Hi everyone,
consider this C++ code (Outlook typelib imported with raw_interfaces_only):
-----------------------------------------------------
Outlook::MAPIFolder* pTargetFolder;
Outlook::_MailItem* pMailItem;
....
//
// pTargetFolder and pMailItem are correctly initialized here
//
....
IDispatch* pReturnedItem;
HRESULT hr = pMailItem->Move(pTargetFolder, &pReturnedItem);
-----------------------------------------------------
As far as I understand, pReturnedItem points to a new object that represents
the moved item. I further call QueryInterface() on it to obtain a pointer to
Outlook::_MailItem.
The question is: should I call Release() on the original pMailItem after
Move()?
I would think so, but I'm chasing a weird bug that makes Outlook XP crash on
exit, in InterlockedDecrement in kernel32.dll, called from ole32.dll. I'm
suspicious that InterlockedDecrement is used to decrement the reference
count on a COM object, and that something is getting released one time too
many in my code.
Thanks in advance,
Martynas
consider this C++ code (Outlook typelib imported with raw_interfaces_only):
-----------------------------------------------------
Outlook::MAPIFolder* pTargetFolder;
Outlook::_MailItem* pMailItem;
....
//
// pTargetFolder and pMailItem are correctly initialized here
//
....
IDispatch* pReturnedItem;
HRESULT hr = pMailItem->Move(pTargetFolder, &pReturnedItem);
-----------------------------------------------------
As far as I understand, pReturnedItem points to a new object that represents
the moved item. I further call QueryInterface() on it to obtain a pointer to
Outlook::_MailItem.
The question is: should I call Release() on the original pMailItem after
Move()?
I would think so, but I'm chasing a weird bug that makes Outlook XP crash on
exit, in InterlockedDecrement in kernel32.dll, called from ole32.dll. I'm
suspicious that InterlockedDecrement is used to decrement the reference
count on a COM object, and that something is getting released one time too
many in my code.
Thanks in advance,
Martynas