cztomczak / cefcapi

An example on how to use C API in Chromium Embedded Framework (CEF)
Other
166 stars 48 forks source link

Exception code 80000003 in cef_execute_process on Windows #6

Closed cztomczak closed 7 years ago

cztomczak commented 7 years ago

I am in the process of updating the cefcapi project to CEF branch 3029. On Linux everything went fine. However on Windows I am getting exception code 80000003 during a call to cef_execute_process. Here are the logs with backtrace:

Starting program: C:\github\cefcapi\Release/cefcapi.exe
[New Thread 5776.0x85c]
CEF version: 3.3029.1608.g27a32db
initialize_cef_app
initialize_cef_base_ref_counted
cef_base_ref_counted_t.size = 36
cef_execute_process, argc=1
cef_base_ref_counted_t.add_ref

Program received signal SIGTRAP, Trace/breakpoint trap.
0x02152469 in ?? ()
(gdb) bt
#0  0x02152469 in ?? ()
#1  0x10b9534c in libcef!cef_execute_process () from C:\github\cefcapi\Release\libcef.dll
#2  0x00401a54 in main ()

Building with gcc on Windows. I've tried both mingw GCC (5.3.0) and TDM-gcc (5.1.0) and both end up with that same exception code. From what I know I can't use PDB files with gdb to get a meaningful stack trace.

On Linux it runs fine, but gcc version is 4.8.2, so it's different.

cztomczak commented 7 years ago

The fix is to define CEF_CALLBACK __stdcall. Patch:

diff --git a/include/internal/cef_export.h b/include/internal/cef_export.h
index 2813253b..e78be029 100644
--- a/include/internal/cef_export.h
+++ b/include/internal/cef_export.h
@@ -48,7 +48,11 @@
 #elif defined(COMPILER_GCC)

 #define CEF_EXPORT __attribute__ ((visibility("default")))
+#ifdef OS_WIN
+#define CEF_CALLBACK __stdcall
+#else
 #define CEF_CALLBACK
+#endif

 #endif  // COMPILER_GCC
cztomczak commented 7 years ago

Upstream CEF issue: https://bitbucket.org/chromiumembedded/cef/issues/1209/wrong-calling-convention-for-callbacks

Reports on the Forum:

  1. https://magpcss.org/ceforum/viewtopic.php?f=6&t=15106
  2. http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11505
cztomczak commented 7 years ago

Fixed in commit c318fa2.