[Bug 49802] Crashes of x64 apps on macOS when built with VS2019

WineHQ Bugzilla wine-bugs at winehq.org
Thu Sep 10 02:56:20 CDT 2020


https://bugs.winehq.org/show_bug.cgi?id=49802

--- Comment #3 from Reinhold <reinhold.hoffmann at hotmail.com> ---
After working on workarounds for this issue with VS2019 it turns out that there
is a broader impact than originally thought. I therefore changed the title of
this bug report.

The core reasons are that the two function calls
------------------------------------------------
(1)
__acrt_get_begin_thread_init_policy in libucrt:win_policies.obj
called by thread.cpp as part of ucrt

(2)
__acrt_get_process_end_policy in libucrt:win_policies.obj
called by exit.cpp as part of ucrt

end in the nowhere according to the comment from Ken Thomases here.


Impact:
-------
(1) is used in the function calls "_beginthread" and "_beginthreadex". 
These functions are called when a thread is started like in AfxBeginThread.
Using features from MFC like CMFCMenuBar, CMFCToolBar etc. from MFC of VS2019
x64 use these calls frequently e.g. in AFXPlaySystemSound. This means that apps
using CMFCMenuBar, CMFCToolBar etc. from MFC of VS2019 won't run on Wine macOS
x64.

(2) is used in the regular call "exit" 
This means that any regular end of an x64 app which is build with MFC of VS2019
craches on Wine macOS x64. The crash happens either at once or the app ends up
in a loop where the app needs to be terminated using the Force Quit command of
the Mac.

Possible workarounds with VS2019:
(1) when threads are only selectively used with AfxBeginThread, replacing those
calls by CreateThread may help but please consider
https://stackoverflow.com/questions/21718674/difference-between-afxbeginthread-and-createthread

(2)  
Before exiting the x64 app the call 
TerminateProcess(GetCurrentProcess(), return_code);
can help to terminate app without ending in a crash.

-- 
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