[directmusic] Re: DX9 DM Shutdown crash

  • From: "Aaron R Leiby" <aleiby@xxxxxxxxxxxxx>
  • To: <directmusic@xxxxxxxxxxxxx>
  • Date: Thu, 13 Mar 2003 11:40:29 -0500

Yeah, I'm getting an 'ASSERT: "g_cComponent == 0"' error (debug level 5) in
DSWAVE, DMSYNTH, DMUSIC and DMLOADER.  As far as I can tell, I'm cleaning up
all objects appropriately.  I was originally leaking the container and
script, but those should be getting release properly now.  How important is
order?

I'm releasing things in the following order:
1. loader->ReleaseByUnknown( script );
2. script->Release();
3. performance->Stop(NULL,NULL,0,0);
4. performance->CloseDown();
5. performance->Release();
6. loader->Release();
7. CoUninitialize();

(loader->ReleaseByUnknown(container); container->Release(); happens right
after the script is loaded in the first place.)

We're mixing OpenAL and DirectMusic, and it looks like maybe DirectSound is
getting shutdown prematurely, though I haven't figured out a way to verify
or fix this.  Anyone have any experience with this combination?  Does
DirectSound share well, or will DirectMusic create its own copy?

If I shut down DirectMusic mid-game using the same code, I get none of these
problems.  Shutting down DirectMusic before or after shutting down OpenAL
changes a few of the warnings, but still crashes in either case.  Disabling
either avoids the crash.

The thread that crashes appears to get set up in the call to InitAudio, then
just sleeps until CloseDown is called on the performance, and doesn't appear
to do anything in between.  Any idea what that is?  Any idea why dmusic.dll
would get unloaded before that thread wakes back up?

Thanks.

Also, we're getting lots of the following:
DSOUND: Error: Lock size must be > 0
DMIME: Couldn't find SegState in GetParam call.


Aaron


----- Original Message -----
From: "Dugan Porter" <duganp@xxxxxxxxxxxxxxxxxxxxx>
To: <directmusic@xxxxxxxxxxxxx>
Sent: Thursday, March 13, 2003 1:31 AM
Subject: [directmusic] Re: DX9 DM Shutdown crash


>
> Aaron, you might want to ensure that you have released all your
> DirectMusic objects before any of your DLLs start to unload.  Since you
> are apparently using the debug version of dmusic (all the DLLs have a
> "d" added to their name), you can also enable debug spew in the DirectX
> control panel applet and see if you get any messages like "DMusic:
> ASSERT(g_cComponent !=3D 0) failed" when you close down.  This should =
> give
> you an indication of which objects you are leaking, if any.
>
> Hope that helps,
> Dugan Porter - Audio API Dev Lead
> This posting is provided "as is" with no warranties, and confers no
> rights
>
>
> -----Original Message-----
> From: Aaron R Leiby [mailto:aleiby@xxxxxxxxxxxxx]=20
> Sent: Wednesday, March 12, 2003 3:53 PM
> To: directmusic@xxxxxxxxxxxxx
> Subject: [directmusic] DX9 DM Shutdown crash
>
>
>
> When we shut down our game, if the current level is using direct music,
> direct music will get shut down near the end of the game's exit
> sequence. This often causes a crash in the dmusicd.dll thread.  What
> seems to be happening is that while that thread is sleeping, dmusicd.dll
> gets unloaded, so when it wakes up it gets an access violation (this is
> just from looking at the call stack for the thread before and after the
> crash).  This doesn't happen in DX8.  It also doesn't happen if we shut
> down direct music mid-game (which we do all the time since only some
> levels use direct music).
>
> Any ideas what can be done to avoid this?
>
> We're using the CMusicManager wrapper class, and passing NULL for the
> HWND for Initialization.  Could that have anything to do with it?  Any
> idea why this isn't a problem in DX8.1?
>
> Thanks.
>
>
> Aaron
>
>
>


Other related posts: