Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
Operating System: ReactOS
Platform: x86 Hardware
Description
Created an attachment (id=2682)
Fix race condition in msgina
There is a race condition in msgina/gui.c that will occasionally cause startup to hang at "Loading your personal settings". To demonstrate, add a Sleep in StartupWindowThread after DialogBoxParam returns, and it will happen every time.
The problem: GUIRemoveStatusMessage destroys the dialog, but does not clear pgContext->SignaledStatusWindowCreated. It relies on the old dialog thread to do that. But sometimes, the old dialog thread doesn't get to do so before GUIDisplayStatusMessage is called again. When the new dialog thread initializes, it sees that SignaledStatusWindowCreated is TRUE, and so it doesn't set the event; the main thread hangs in WaitForSingleObject forever.
All the cleanup needs to be done in GUIRemoveStatusMessage only, to ensure that it gets done before a new dialog is created, and never after.