I'm implementing webview of wxwidgets using CEF3, and have made some process, but I'm struggling with an `EXC_BAD_ACCESS` crash issue on Mac OS X during CefShutdown period, using the newest release version 3.1750.1738.
I notice that CefShutdown should be called after CEFMessageLoop has been quited and before the application exits(So I call it in wxApp::OnExit), but it will raise the issue, below is the crash stacktrace with CEF symbol version:
- Code: Select all
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010
VM Regions Near 0x10:
-->
__TEXT 00000001042f5000-0000000104b9c000 [ 8860K] r-x/rwx SM=COW /Users/USER/*/webview_chromium.app/Contents/MacOS/webview_chromium
Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff90ae962a (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 454
1 com.apple.CoreFoundation 0x00007fff8618fb72 _CFAutoreleasePoolPop + 50
2 com.apple.Foundation 0x00007fff898a8e17 -[NSAutoreleasePool drain] + 147
3 org.chromium.ContentShell.framework 0x0000000107992918 content::ContentMainRunnerImpl::Shutdown() + 360 (scoped_ptr.h:137)
4 org.chromium.ContentShell.framework 0x00000001053db271 CefContext::Shutdown() + 529 (scoped_ptr.h:243)
5 org.chromium.ContentShell.framework 0x00000001053dafc4 CefShutdown() + 180 (context.cc:147)
6 org.wxwidgets.samples.webview-chromium 0x0000000104312e0b CefShutdown() + 27 (libcef_dll_wrapper.cc:167)
7 org.wxwidgets.samples.webview-chromium 0x00000001043958d9 wxWebViewChromium::Shutdown() + 9 (webview_chromium.cpp:495)
8 org.wxwidgets.samples.webview-chromium 0x00000001042f7619 WebApp::OnExit() + 25 (webview.cpp:251)
9 org.wxwidgets.samples.webview-chromium 0x000000010442741d wxEntry(int&, wchar_t**)::CallOnExit::~CallOnExit() + 29 (init.cpp:489)
10 org.wxwidgets.samples.webview-chromium 0x0000000104427155 wxEntry(int&, wchar_t**)::CallOnExit::~CallOnExit() + 21 (init.cpp:489)
11 org.wxwidgets.samples.webview-chromium 0x0000000104427035 wxEntry(int&, wchar_t**) + 341 (init.cpp:496)
12 org.wxwidgets.samples.webview-chromium 0x000000010442719f wxEntry(int&, char**) + 63 (init.cpp:507)
13 org.wxwidgets.samples.webview-chromium 0x00000001042f7026 main + 38 (webview.cpp:198)
14 org.wxwidgets.samples.webview-chromium 0x00000001042f6fd4 start + 52
I use wxTimer to run CefDoMessageLoopWork to integrate CEF messageloop into wxwidgets messageloop.
It works fine on Win/Linux platforms, Howerver on OS X, it raises the issue. I have tried to fix the issue, but still have no progress.
The more insteresting is if I put `CEFShutdown` during CEF window destroy period, it quits fine on OS X while crash issue raises on Win/Linux platforms . The related is here https://github.com/hokein/wxWidgets/blob/SOC2014_WEBVIEW_CHROMIUM/samples/webview_chromium/webview.cpp#L249
I found there are some people also fail with the same `EXC_BAD_ACCESS`issue before, see [1][2], but it seems no solutions yet.
I would be much appreciated if anyone can provide some help or suggestions.
Thanks,
Haojian
[1] - http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11347
[2] - http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11441