aliens

Author Topic: [Task] ole32.dll crash on exit  (Read 8421 times)

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
[Task] ole32.dll crash on exit
« on: September 27, 2010, 11:34:54 pm »
This is something that only happens once every million years, it's really really minor, but in case someone's good at debugging, I'm posting it here.

Basically, every once in a while when quitting OpenXcom on Windows, it crashes. That's right, it crashes right when exiting, what tough timing. And there's absolutely no helpful debug information, this is all I can get:

Message:
Quote
First-chance exception at 0x75b7830e in OpenXcom.exe: 0xC0000005: Access violation reading location 0x00000020.
Unhandled exception at 0x75b7830e in OpenXcom.exe: 0xC0000005: Access violation reading location 0x00000020.

Stack Trace:
Quote
>   ole32.dll!75b7830e()    
    [Frames below may be incorrect and/or missing, no symbols loaded for ole32.dll]   
    ole32.dll!75b78526()    
    ole32.dll!75b41df2()    
    dsound.dll!5ad6e880()    
    dsound.dll!5ad6e668()    
    dsound.dll!5ad6e60f()    
    dsound.dll!5ad6e43a()    
    dsound.dll!5ad73ea0()    
    dsound.dll!5ad73e2e()    
    dsound.dll!5ad6e43a()    
    dsound.dll!5ad735e9()    
    dsound.dll!5ad73606()    
    dsound.dll!5ad73a7c()    
    dsound.dll!5ad73646()    
    SDL.dll!6813d4fe()    
    SDL.dll!681021a6()    
    ntdll.dll!7760fa7a()    
    ntdll.dll!77630e92()    
    ntdll.dll!77629d15()    

Given the crash only happens on exit, it's likely that something isn't getting destroyed properly, but tracking it down is damn-near impossible, given how random it is, and by the time it happens the program is far away from my own code and deep in Windows' own sub-routines. So if anyone's got an obscene amount of time to waste... :P

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: [Task] ole32.dll crash on exit
« Reply #1 on: October 04, 2010, 05:51:23 pm »
Do we know which "quit" method is being used? ie. Alt F4, or game menu, Window X button? or which screen is active (Geo, base, etc.)?

By looking at the call stack, I would guess that it's trying to play a sound after DirectSound has been disposed of. I'll take a look, see what I can find

I so hope this isn't an SDL bug

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: [Task] ole32.dll crash on exit
« Reply #2 on: October 04, 2010, 11:12:47 pm »
Usually I close the game with the Windows X button on the Geoscape, though I can't guarantee it doesn't happen elsewhere.

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: [Task] ole32.dll crash on exit
« Reply #3 on: October 05, 2010, 10:24:37 am »
I know, but if you start with somewhere you know it does happen, you're more likely to find it :-)

Edit
SDL.dll!681021a6() is the SDL_AudioQuit(), which calls the SDL_QuitSubSystem(SDL_INIT_AUDIO)

First I thought this might be a problem, as you call both Mix_CloseAudio and SDL_Quit - thinking they'd both try and close the audio, but because Mix_CloseAudio also calls SDL_AudioQuit, it removes the SDL_INIT_AUDIO flag from it's internal list, so SDL_QUIT doesn't try to recall it...

Really could do with finding a way to reproduce this
« Last Edit: October 05, 2010, 11:14:15 am by pmprog »

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: [Task] ole32.dll crash on exit
« Reply #4 on: October 06, 2010, 11:48:09 am »
Well I stop all the sounds before shutting down the game now, hopefully that fixed it.