Bug 145832

Summary: [WinCairo] Crash on exit when terminating egl
Product: WebKit Reporter: peavo
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, cgarcia, mcatanzaro
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=157973
Attachments:
Description Flags
Patch
none
Patch
none
Patch cgarcia: review+

Description peavo 2015-06-10 00:05:24 PDT
I'm getting a crash on exit when egl is being terminated.

 	atidxx32.dll!5aa314c8() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for atidxx32.dll]	
 	atiuxpag.dll!73fb29f7() 	
 	d3d11.dll!5814e03c() 	
 	d3d11.dll!5814b4dd() 	
 	d3d11.dll!5814d979() 	
 	d3d11.dll!5814bb03() 	
 	d3d11.dll!5816cbe8() 	
 	d3d11.dll!5816c59d() 	
 	d3d11.dll!5816cb06() 	
 	d3d11.dll!5816c8c0() 	
 	d3d11.dll!5816c75e() 	
 	d3d11.dll!58149241() 	
>	libGLESv2.dll!rx::SwapChain11::release()  Line 57 + 0xd bytes	C++
 	libGLESv2.dll!rx::SwapChain11::`scalar deleting destructor'()  + 0x11 bytes	C++
 	libEGL.dll!egl::Surface::`scalar deleting destructor'()  + 0x1e bytes	C++
 	libEGL.dll!egl::Display::terminate()  Line 125 + 0x15 bytes	C++
 	libEGL.dll!eglTerminate(void * dpy)  Line 157	C++
 	WebKit.dll!WebCore::PlatformDisplayWin::`scalar deleting destructor'()  + 0x1a bytes	C++
 	WebKit.dll!`WebCore::PlatformDisplay::sharedDisplay'::`2'::`dynamic atexit destructor for 'display''()  + 0x10 bytes	C++
 	WebKit.dll!_CRT_INIT(void * hDllHandle, unsigned long dwReason, void * lpreserved)  Line 416	C
 	WebKit.dll!__DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved)  Line 522 + 0xc bytes	C
 	WebKit.dll!_DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved)  Line 472 + 0xe bytes	C
 	ntdll.dll!77668d44()
Comment 1 peavo 2015-06-10 00:09:51 PDT
Created attachment 254631 [details]
Patch
Comment 2 Carlos Garcia Campos 2015-06-10 00:47:08 PDT
Comment on attachment 254631 [details]
Patch

I don't think this is correct, I didn't use NeverDestroyed on purpose, since both X11 and wayland display implementation have cleanup in their destructors. I think the point here is why it crashes on windows when terminating EGL, and if it's a windows specific bug, I would add an ifdef to the destructor for windows platform to avoid the EGL termination
Comment 3 peavo 2015-06-10 01:52:32 PDT
Created attachment 254637 [details]
Patch
Comment 4 peavo 2015-06-10 01:53:12 PDT
(In reply to comment #2)
> Comment on attachment 254631 [details]
> Patch
> 
> I don't think this is correct, I didn't use NeverDestroyed on purpose, since
> both X11 and wayland display implementation have cleanup in their
> destructors. I think the point here is why it crashes on windows when
> terminating EGL, and if it's a windows specific bug, I would add an ifdef to
> the destructor for windows platform to avoid the EGL termination

Thanks for reviewing :) Updated patch.
Comment 5 Carlos Garcia Campos 2015-06-10 02:04:21 PDT
Comment on attachment 254637 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=254637&action=review

Ok, I think it would be interesting to know why it crashes, though, you might be hiding an actual bug rather than fixing it.

> Source/WebCore/platform/graphics/PlatformDisplay.cpp:112
> +#if USE(EGL) && !PLATFORM(WIN) // WinCairo crashes when terminating EGL on exit

I would move the comment to the previous line, finishing with a period, and adding a link to this bug. And if this is not supposed to crash on termination, it should be a FIXME comment to make it clear this is a workaround, not the proper fix.
Comment 6 peavo 2015-06-10 03:27:11 PDT
I believe it crashes because libEGL.dll is unloaded before eglTerminate is called.
Comment 7 peavo 2015-06-10 04:07:18 PDT
Created attachment 254644 [details]
Patch
Comment 8 peavo 2015-06-10 04:35:43 PDT
Committed r185411: <http://trac.webkit.org/changeset/185411>
Comment 9 Michael Catanzaro 2016-06-01 05:19:36 PDT
Could this be bug #157973?