Opened 15 years ago

Closed 3 years ago

Last modified 3 years ago

#4502 closed defect (fixed)

BASE: ScummVM won't quit if error() is called in a timer callback

Reported by: eriktorbjorn Owned by: eriktorbjorn
Priority: normal Component: --Other--
Version: Keywords:
Cc: Game:


Current SVN snapshot.

If ScummVM calls error() inside a timer callback (e.g. in some parts of Digital iMUSE), ScummVM won't quit no matter (almost) what you do. I believe this is because when OSystem_SDL::quit() deletes _timer, it has to wait for the timer class to release its mutex. And that won't happen since we're still inside the timer callback.

I'm not sure how to fix this.

Ticket imported from: #2830903. Ticket imported from: bugs/4502.

Change History (11)

comment:1 by fingolfin, 15 years ago

Nasty. Doesn't the issue run deeper, though? If we error(), we open a GUI console. This is now *inside* the timer callback, which thus never returns. That sounds like it might cause bad things, too...

So, how about this approach: Modify OSystem_SDL::quit() to detect whether we are in the time handler. If we are, don't bother to cleanly update anything, just quit right away (using "exit(1)" maybe). That should solve at least the "doesn't quit" issue, at least for the SDL backend.

comment:2 by eriktorbjorn, 15 years ago

I was focusing only on the problem I could see with my own eyes, but it's quite possible that - as you say - the problem runs much deeper than that, so that when the GUI is running, it's already too late.

The downside to quitting immediately is of course that this may make it harder to diagnose problems with corrupt audio files in games that use Digital iMUSE. (Something that seems to happen surprisingly often, for reasons I do not understand.) But perhaps those parts of the code could be rewritten to not use error() directly.

comment:3 by Mataniko, 6 years ago

Owner: set to eriktorbjorn

eriktorbjorn - Does this bug still happen? Do you have a reproduction?

comment:4 by Mataniko, 6 years ago

Owner: changed from eriktorbjorn to Mataniko
Resolution: duplicate
Status: newclosed

This seems like a duplicate of Looks like this needs a fix specifically in imuse if this is still an issue.

Last edited 6 years ago by Mataniko (previous) (diff)

comment:5 by Mataniko, 6 years ago

Resolution: duplicate
Status: closednew

comment:6 by Mataniko, 6 years ago

Owner: changed from Mataniko to eriktorbjorn

comment:7 by digitall, 6 years ago

Component: --Unset----Other--

comment:8 by raziel-, 4 years ago

Summary: ScummVM won't quit if error() is called in a timer callbackBASE: ScummVM won't quit if error() is called in a timer callback

comment:9 by athrxx, 3 years ago

Is this still relevant?

comment:10 by bluegr, 3 years ago

Resolution: fixed
Status: newclosed

This is probably not relevant anymore, after the fixes to the MIDI mutexes and iMUSE. Assigning to eriktorbjorn, who did the mutex fixes

comment:11 by eriktorbjorn, 3 years ago

I no longer remember where the original error() was, so I tried adding one to Mixer_Impl::mixCallback(). It popped up some kind of error dialog, but the game kept running until I clicked the "OK" button. (At that point, it would sometimes segfault.)

Which is probably not optimal, but I guess if there's an error() then all bets are off...

Note: See TracTickets for help on using tickets.