mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
bootstrap: Don't explicitly call FreeLibary (see #3935)
This avoids an illegal access during shutdown.
This commit is contained in:
@@ -328,8 +328,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||||||
using kProcType = decltype(&RunWinMain);
|
using kProcType = decltype(&RunWinMain);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int result_code;
|
|
||||||
|
|
||||||
// Load the client DLL normally.
|
// Load the client DLL normally.
|
||||||
if (HMODULE hModule = ::LoadLibrary(dll_name.c_str())) {
|
if (HMODULE hModule = ::LoadLibrary(dll_name.c_str())) {
|
||||||
if (auto* pFunc = (kProcType)::GetProcAddress(hModule, kProcName)) {
|
if (auto* pFunc = (kProcType)::GetProcAddress(hModule, kProcName)) {
|
||||||
@@ -349,11 +347,16 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||||||
cef_version_info_t version_info = {};
|
cef_version_info_t version_info = {};
|
||||||
CEF_POPULATE_VERSION_INFO(&version_info);
|
CEF_POPULATE_VERSION_INFO(&version_info);
|
||||||
|
|
||||||
|
// Return immediately without calling FreeLibrary() to avoid an illegal
|
||||||
|
// access during shutdown. The sandbox broker owns objects created inside
|
||||||
|
// libcef.dll (SandboxWin::InitBrokerServices) and cleanup is triggered
|
||||||
|
// via an _onexit handler (SingletonBase::OnExit) called after wWinMain
|
||||||
|
// exits.
|
||||||
#if defined(CEF_BUILD_BOOTSTRAP_CONSOLE)
|
#if defined(CEF_BUILD_BOOTSTRAP_CONSOLE)
|
||||||
result_code = pFunc(argc, argv, &sandbox_info, &version_info);
|
return pFunc(argc, argv, &sandbox_info, &version_info);
|
||||||
#else
|
#else
|
||||||
result_code =
|
return pFunc(hInstance, lpCmdLine, nCmdShow, &sandbox_info,
|
||||||
pFunc(hInstance, lpCmdLine, nCmdShow, &sandbox_info, &version_info);
|
&version_info);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
@@ -369,8 +372,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||||||
LOG(FATAL) << "Failed to find " << kProcName << " in " << dll_name
|
LOG(FATAL) << "Failed to find " << kProcName << " in " << dll_name
|
||||||
<< ".dll with error " << ::GetLastError();
|
<< ".dll with error " << ::GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeLibrary(hModule);
|
|
||||||
} else {
|
} else {
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
if (!is_sandboxed) {
|
if (!is_sandboxed) {
|
||||||
@@ -385,7 +386,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||||||
<< ::GetLastError();
|
<< ::GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOG(FATAL) is [[noreturn]], so we only reach this point if everything
|
// LOG(FATAL) is [[noreturn]], so we never reach this point.
|
||||||
// succeeded.
|
NOTREACHED();
|
||||||
return result_code;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user