#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: |
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 (11)
comment:1 by , 15 years ago
comment:2 by , 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 , 7 years ago
Owner: | set to |
---|
eriktorbjorn - Does this bug still happen? Do you have a reproduction?
comment:4 by , 7 years ago
Owner: | changed from | to
---|---|
Resolution: | → duplicate |
Status: | new → closed |
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.
comment:5 by , 7 years ago
Resolution: | duplicate |
---|---|
Status: | closed → new |
comment:6 by , 7 years ago
Owner: | changed from | to
---|
comment:7 by , 6 years ago
Component: | --Unset-- → --Other-- |
---|
comment:8 by , 4 years ago
Summary: | ScummVM won't quit if error() is called in a timer callback → BASE: ScummVM won't quit if error() is called in a timer callback |
---|
comment:10 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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 , 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...
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.