Closed
Description
This was reproduced in hello_world.py example when running js alert example from w3schools during closing of popup and main windows. Logs and backtrace with gdb:
[CEF Python] Renderer: OnContextCreated()
[CEF Python] Browser: OnProcessMessageReceived(): OnContextCreated
[CEF Python] V8ContextHandler_OnContextCreated()
The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 2306 error_code 3 request_code 3 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
[CEF Python] LifespanHandler_OnBeforeClose
[CEF Python] del g_pyFrames[1#2]
[CEF Python] del g_pyFrames[1#5]
[CEF Python] del g_pyFrames[1#-4]
[CEF Python] del g_pyFrames[1#9]
[CEF Python] del g_pyFrames[1#8]
[CEF Python] del g_pyFrames[1#12]
[CEF Python] del g_pyFrames[1#11]
[CEF Python] del g_pyFrames[1#10]
[CEF Python] del g_pyBrowsers[1]
[CEF Python] Renderer: OnContextReleased()
[CEF Python] LifespanHandler_OnBeforeClose
[CEF Python] del g_pyFrames[2#19]
[CEF Python] del g_pyFrames[2#18]
[CEF Python] del g_pyFrames[2#-4]
[CEF Python] del g_pyFrames[2#23]
[CEF Python] del g_pyFrames[2#22]
[CEF Python] del g_pyFrames[2#21]
[CEF Python] del g_pyFrames[2#20]
[CEF Python] del g_pyFrames[2#14]
[CEF Python] del g_pyFrames[2#15]
[CEF Python] RemovePyBrowser: releasing shared request context
[CEF Python] Renderer: OnContextReleased()
[CEF Python] Renderer: OnContextReleased()
[CEF Python] Renderer: OnContextReleased()
[CEF Python] Renderer: OnContextReleased()
Program received signal SIGSEGV, Segmentation fault.
0x00007fffe5031425 in scoped_refptr::operator= (
this=0x7fffe530f990 <_ZL47__pyx_v_14cefpython_py27_g_sharedRequestContext.20305>, p=0x0)
at /home/cz/github/cefpython/src/include/base/cef_ref_counted.h:348
348 old_ptr->Release();
cef_ref_counted.h line 348 is an assignment operator:
scoped_refptr<T>& operator=(T* p) {
// AddRef first so that self assignment should work
if (p)
p->AddRef();
T* old_ptr = ptr_;
ptr_ = p;
if (old_ptr)
old_ptr->Release();
return *this;
}
There are three being made three NULL assignments to shared request context in CloseBrowser, RemovePyBrowser (called from OnBeforeClose) and in Shutdown:
if g_sharedRequestContext.get():
g_sharedRequestContext.Assign(NULL)
However as you can see there is always check to .get() before .Assign(), so if the value is NULL a Release() will never be called.
From the logs you can see that there are OnContextReleased callbacks still being called after OnBeforeClose. This is probably some issue with CEF, these calls should happen before OnBeforeClose. Reported on CEF Forum: