Opened 9 years ago

Last modified 6 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: --Unset--
Keywords: Cc:
Game:

Description

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

comment:1 Changed 9 years ago by fingolfin

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 Changed 9 years ago by eriktorbjorn

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 Changed 6 months ago by Mataniko

Owner: set to eriktorbjorn

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

comment:4 Changed 6 months ago by Mataniko

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

This seems like a duplicate of https://bugs.scummvm.org/ticket/5862. Looks like this needs a fix specifically in imuse if this is still an issue.

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

comment:5 Changed 6 months ago by Mataniko

Resolution: duplicate
Status: closednew

comment:6 Changed 6 months ago by Mataniko

Owner: changed from Mataniko to eriktorbjorn
Note: See TracTickets for help on using tickets.