macOS Bundle works in app, crashes in Unity

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

macOS Bundle works in app, crashes in Unity

Postby dhof » Thu Nov 24, 2016 8:28 pm

I'm working on a Unity plugin that utilizes CEF. So far I've got CEF building and being included in a .bundle, which exposes TestFunction(), which loads up CEF and does a very simple offscreen rendering test. I'm successfully able to load the .bundle into a separate macOS app at runtime and run the function and everything works as expected. As soon as I try in it in Unity, however, I crash immediately.

I've narrowed down the code that triggers the crash in Unity to the code below:

Code: Select all
void TestFunction() {
    CefSettings settings;
    settings.single_process = true;
    settings.windowless_rendering_enabled = true;
    settings.log_severity = LOGSEVERITY_VERBOSE;
   
    CefRefPtr<SimpleApp> app(new SimpleApp);
   
    // crashes even without a handler — e.g. app.get() — being set
    CefInitialize(CefMainArgs(), settings, NULL, NULL);
   
    CefRunMessageLoop();
}


And here's the stack trace for the crash:

Code: Select all
Thread 95 Crashed:
0   org.chromium.ContentShell.framework   0x000000013d9cccc1 base::debug::BreakDebugger() + 17 (debugger_posix.cc:258)
1   org.chromium.ContentShell.framework   0x000000013d9ec5f0 logging::LogMessage::~LogMessage() + 1248 (logging.cc:748)
2   org.chromium.ContentShell.framework   0x000000013f503cdd gin::(anonymous namespace)::OpenFileIfNecessary(char const*) + 365 (scoped_typeref.h:83)
3   org.chromium.ContentShell.framework   0x000000013f503acc gin::V8Initializer::LoadV8Snapshot() + 44 (v8_initializer.cc:270)
4   org.chromium.ContentShell.framework   0x000000013d760ef2 content::ContentMainRunnerImpl::Initialize(content::ContentMainParams const&) + 1058 (content_main_runner.cc:732)
5   org.chromium.ContentShell.framework   0x000000013d78f2c1 CefContext::Initialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>, void*) + 417 (context.cc:292)
6   org.chromium.ContentShell.framework   0x000000013d78f10b CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>, void*) + 379 (context.cc:144)
7   org.chromium.ContentShell.framework   0x000000013c003ca2 cef_initialize + 194 (libcef_dll.cc:205)
8   cefplugin                             0x00000001202f9c19 CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>, void*) + 361 (libcef_dll_wrapper.cc:197)
9   cefplugin                             0x0000000120221407 TestFunction + 231 (cefplugin.cpp:22)


I'm aware that single process mode isn't supported, but I don't think that's the culprit here, since it's working outside of Unity. Does anyone have any ideas?
dhof
Newbie
 
Posts: 2
Joined: Thu Nov 24, 2016 8:14 pm

Re: macOS Bundle works in app, crashes in Unity

Postby dhof » Thu Nov 24, 2016 10:24 pm

Solved...ish. Chromium is searching for the framework in Unity's /Frameworks directory, rather than the one that is embedded in the bundle. Not sure if there's a good way to fix this. I can work around it in some instances by creating a symlink through a build script, but it seems hacky.
dhof
Newbie
 
Posts: 2
Joined: Thu Nov 24, 2016 8:14 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 45 guests