Re: IWMDMStorageControl3::Insert3 crashing app in threaded mode



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
>


.



Relevant Pages

  • Re: Ray Haddad and "Zen and the Art of Usenet"
    ... Chris H wrote: ... Life is too short. ... I note that recently Google has as a default no quoting when replying. ... If Google has to fit in with Netiquet so should individuals. ...
    (comp.arch.embedded)
  • Re: 06 ISF Scholarship Surplus
    ... Still scared as hell at the news. ... of the real life after such a awsome two week vacation. ... me while I was working on my bike... ... Chris Buckley wrote: ...
    (rec.motorcycles.dirt)
  • Re: Chris Johnson Memorial Raffle
    ... A Thank You from Maria Johnson for the Chris Johnson Memorial ... I wanted to let everyone know that the raffle was a success, ... Chris had a zest for life that was hard to contain and rarely was. ... The girls and I just spent a weekend with some of Chris's ...
    (rec.motorcycles.dirt)
  • Re: 2 weeks today; A testimonial to this wonderful group.
    ... Hi Chris ... For some reason I never saw the original post, ... Welcome to the rest of your longer, healthier life. ...
    (alt.support.diabetes)
  • Re: Chris Johnson more info
    ... Chris and myself has humbled me immensely. ... Chris had a zest for life that was hard to contain and rarely was. ... The girls and I just spent a weekend with some of Chris?s ... We have also named a star "the daddy star" (any random one will ...
    (rec.motorcycles.dirt)