[Bug 22978] New: SimCity2000: race condition causes crash in MCI during startup

wine-bugs at winehq.org wine-bugs at winehq.org
Mon May 31 12:33:15 CDT 2010


           Summary: SimCity2000: race condition causes crash in MCI during
           Product: Wine
           Version: unspecified
          Platform: x86
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: winmm&mci
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: hoehle at users.sourceforge.net

Created an attachment (id=28457)
 --> (http://bugs.winehq.org/attachment.cgi?id=28457)
mci+winmm trace & crash backtrace

The attached log shows a crash that is triggered because the asynchronous
mciseq/mcimidi player is still attempting to open the device while the main
thread already successfully called MCI_CLOSE.
The mcimidi player does not implement proper locking. Unlike mciwave, its state
variable is not yet set to MCI_MODE_PLAY when opening the MIDI device, which
lets MCI_CLOSE not see something is busy playing.
Actually, even looking at mciwave, one can construct unfortunate sequences of
scheduling that would cause mciwave to hang in such a situation. So there's no
trivial patch simply moving 
    wmm->dwStatus = MCI_MODE_PLAY;
a couple of lines up.

The crash generally occurs when starting SimCity 2000 using
"wine 'C:\Program...\Game\simcity.exe'"
Curiously, "wine start simcity.exe" always works. As I said, it's a race
It seems like sometimes, the initialisation of WINMM and MIDI takes a long
The bug is then triggered when MCI_CLOSE is called by the application.

MCI_CLOSE is called, among others, when clicking "exit" in the initial menu.
Often enough, the app crashes before showing this menu. IMHO, the fact that the
app calls MCI_CLOSE that early is triggered by another bug in Wine that AppDB
testers have mentioned every now and often, but never put to Bugzilla: SimCity
2000 starts fine (showing its logo) when using full screen mode, but needs a
resize or uniconify when using a virtual desktop: then presumably, the app
sends MCI_CLOSE to stop the music, causing or not a crash via the present race
BTW, since the crash occurs in the asynchronous MCI MIDI player, the app
nevertheless works...

This issue has nothing to do with the bug, presumably in the app, that "wine
simcity.exe" crashes whereas "wine 'c:\full\path\simcity.exe'" (should) work.

Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the wine-bugs mailing list