Re: atldbcli.h line 6200 (VC 7.1):

From: Kim Gräsman (kim_at_mvps.org)
Date: 04/27/04


Date: Tue, 27 Apr 2004 22:48:35 +0200

Egbert,

> > These things are always /interesting/... Can you verify that the
> > apartment that instantiated that object is still alive?
>
> There's a dutch proverb, 'you've hit the nail with the hammer' :)

I'm glad - though it's only because I've lived through that pain myself :)

> This bug happens, indeed, if the apartment is destroyed. If it's still
> alive, I'm not sure but guess for 90% that at FinalRelease, this bug
> happens.

The crash pretty much indicates that the interface pointer is no longer
valid. In the case of the 'disappearing apartment', it's because apartment
shutdown tears down all stubs, but I guess there can be other cases during
process shutdown where you'll have stray pointers.

> It happens at a global allocated ATL::CDataSource object within
> FinalRelease...

When that global's FinalRelease is called, it's almost guaranteed there are
no valid pointers left. Most threads will have done their CoUninitialize,
and finished up.
You need to provoke FinalRelease earlier in your shutdown process/process
shutdown.

-- 
Best regards,
Kim Gräsman


Relevant Pages

  • Re: atldbcli.h line 6200 (VC 7.1):
    ... In the case of the 'disappearing apartment', ... process shutdown where you'll have stray pointers. ... When that global's FinalRelease is called, ...
    (microsoft.public.data.oledb)
  • Re: STA vs. MTA when calling out-of-process objects
    ... switched to retrieving the interface pointers always from the GIT. ... apartment than the one that created it, ...
    (microsoft.public.vc.atl)
  • Re: CoUninitialize hang after mixing neutral and free objects
    ... > first for the "neutral" object, and it eventually leads to calling ... > FinalRelease for the "free" object. ... > There are, of course, two proxies (for the "neutral" object and its proxy ... in what apartment does the "neutral" object live? ...
    (microsoft.public.vc.atl)
  • Re: Questions about apartment threading models
    ... Win32 programs that never make any COM calls - not even CoInitialize. ... an appropriate apartment is ... Pointers don't belong to apartments - COM objects do. ... some apartment belongs to that apartment. ...
    (microsoft.public.win32.programmer.ole)
  • Re: Questions about apartment threading models
    ... Of course there exist Win32 ... an appropriate apartment is ... Pointers don't belong to apartments - COM objects do. ... apartment belongs to that apartment. ...
    (microsoft.public.win32.programmer.ole)