Re: IWMDMStorageControl3::Insert3 crashing app in threaded mode
- From: "Chris" <chris@xxxxxxxxxxxx>
- Date: Fri, 19 Aug 2005 12:56:18 -0400
Wow, looking at my code the problem hit me. The last parameter was a
CComPtr allocated on the stack. Then the method completed the thread would
be writing to a released object. Fine, so I pass NULL as the last argument
per the API:
"[out] Pointer to an IWMDMStorage interface that will contain the new
content. This parameter can be set to NULL."
And I get an assertion:
"0x000006F4: A null reference pointer was passed to the stub."
I could have a member object for the last parameter so it will exist past
the life of the method, which seems kind of counter-productive.
Any ideas?
-- Chris
"Chris" <chris@xxxxxxxxxxxx> wrote in message
news:ON5gWONpFHA.4088@xxxxxxxxxxxxxxxxxxxxxxx
>I am calling IWMDMStorageControl3::Insert3 as follows:
>
> hr = pStorageControl3->Insert3(
> WMDM_MODE_THREAD | WMDM_CONTENT_FILE,
> WMDM_FILE_ATTR_FILE,
> pszFileName, // source file
> pFileName, // destination file
> NULL,
> m_pIProgress, // IWMDMProgress
> pIMetaData, // IWMDMMetaData
> NULL,
> &pINewStorage);
>
> Whenever I use WMDM_MODE_THREAD I get heap corruption and random crashes
> after the file copies (usual after the second copy). I can rule out the
> progress and metadata argument, because even if these are NULL I get the
> crash. It works fine in WMDM_MODE_BLOCK, but I need to do it in a
> background thread.
>
> FYI: This is being used in a ATL wizard COM object using apartment
> threading being called a .NET. I am pretty sure it's a threading issue
> out of my realm of understanding but for the life of me I don't know
> what's going wrong.
>
> -- Chris
>
.
- References:
- Prev by Date: WMDM: IWMDMStorageControl3::Insert3 crashing app in threaded mode
- Next by Date: Re: Plugin to handle file with custom extension
- Previous by thread: WMDM: IWMDMStorageControl3::Insert3 crashing app in threaded mode
- Next by thread: Re: IWMDMStorageControl3::Insert3 crashing app in threaded mode
- Index(es):
Relevant Pages
|