File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 2020 (set flag.new_cef_exe on the build server to generate new exe)
2121*/
2222
23- #include < Windows.h>
23+ #include < cstdlib>
24+ #include < functional>
2425
25- [[nodiscard]] int __declspec (dllimport) InitCEF();
26+ struct HINSTANCE__ ;
27+ using HINSTANCE = HINSTANCE__*;
28+ using LPSTR = char *;
2629
27- int __stdcall WinMain (
28- [[maybe_unused]] HINSTANCE hInstance,
29- [[maybe_unused]] HINSTANCE hPrevInstance,
30- [[maybe_unused]] LPSTR lpCmdLine,
31- [[maybe_unused]] int nCmdShow )
30+ [[nodiscard( " InitCEF return value must be used " )]] __declspec(dllimport) auto InitCEF () -> int;
31+
32+ // Users are faced with vague crashes in CEFLauncher.exe, so rather than over-engineering all this is intended
33+ // Do note that CEFLauncher.exe ends up hosting any GPU rendering processes of CEF
34+ int __stdcall WinMain (HINSTANCE, HINSTANCE, LPSTR, int )
3235{
33- return InitCEF ();
36+ const auto init = std::function<int ()>{InitCEF};
37+ const auto safe_invoke = [&]() noexcept -> int
38+ {
39+ try
40+ {
41+ return std::invoke_r<int >(init);
42+ }
43+ catch (...)
44+ {
45+ return EXIT_FAILURE;
46+ }
47+ };
48+ return safe_invoke ();
3449}
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ project "CEFLauncher"
3434
3535 filter {" system:windows" , " configurations:Debug" }
3636 defines { " _DEBUG" }
37+ runtime " Debug"
3738
3839 filter {" system:windows" , " configurations:Release" }
3940 optimize " Speed"
You can’t perform that action at this time.
0 commit comments