https://bugs.winehq.org/show_bug.cgi?id=40714
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |loader Ever confirmed|0 |1 Summary|Oblivon Script Extender |process_attach is executed |cannot load under |too early for forwarded |wine-staging |exports (Oblivon Script | |Extender cannot load under | |wine-staging) Product|Wine-staging |Wine Status|UNCONFIRMED |NEW
--- Comment #10 from Sebastian Lackner sebastian@fds-team.de --- I do not have a proposed patch yet, but I'm going to post my analysis here to make sure it doesn't get lost in the meantime. As it turns out this is not really a Wine Staging regression, its a loader issue which occurs under specific circumstances.
Explanation of what is happening:
* OBSE starts the main process in suspended mode.
* Main process has finished process initialization and calls the init_process_done wineserver call. A signal is sent to suspend the thread as soon as possible.
* Main process calls fixup_imports, which in turn imports additional dlls (import_dll). find_forwarded_export gets called and runs find_forwarded_export. Unfortunately, this immediately calls process_attach, although the signals are still blocked (!)
* Main process performs gdi32 font initialization (although signals are blocked). When performing the select wineserver call to wait on the font mutex, this request is never fulfilled. Please note that the thread is not properly suspended though, the wineserver has no suspend context for example.
* OBSE sends APCs to allocate memory and start a new thread. Those APCs are processed by the main process which is still stuck in the select call.
* The newly created thread tries to run other gdi32 functions (although the font initialization is not done yet).
In the development version of wine, the new thread will initialize the fonts itself, and OBSE will magically work although things are going terribly wrong in the background. In Wine Staging however, a run-once section is used to control initialization of the freetype. This will lead to a deadlock because the main thread is still stuck in the middle of the initialization, and the new thread will not attempt to run initialization itself.
The real problem however is not a Wine Staging issue, but instead that font initialization (or in general process_attach) is called too early for forwarded imports.