Opened 10 years ago

Last modified 13 months ago

#4502 new defect

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

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


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 (7)

comment:1 by fingolfin, 10 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, 10 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, 22 months ago

Owner: set to eriktorbjorn

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

comment:4 by Mataniko, 22 months 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 22 months ago by Mataniko (previous) (diff)

comment:5 by Mataniko, 22 months ago

Resolution: duplicate
Status: closednew

comment:6 by Mataniko, 22 months ago

Owner: changed from Mataniko to eriktorbjorn

comment:7 by digitall, 13 months ago

Component: --Unset----Other--
Note: See TracTickets for help on using tickets.