[Webkit-unassigned] [Bug 157973] PlatformDisplay crash when calling egl_terminate

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 2 00:04:42 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=157973

--- Comment #12 from Zan Dobersek <zan at falconsigh.net> ---
Comment on attachment 280238
  --> https://bugs.webkit.org/attachment.cgi?id=280238
Updated patch

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

>> Source/WebCore/platform/graphics/PlatformDisplay.cpp:169
>> +    std::atexit([] { PlatformDisplay::sharedDisplay().terminateEGLDisplay(); });
> 
> Since this is not a static function, I think it make more sense to not use PlatformDisplay::sharedDisplay() here. You say you cannot capture |this| here, but I don't understand why not; did you try writing it this way:
> 
> std::atexit([this] { this->terminateEGLDisplay(); });

std::atexit() has to be passed a function pointer to a static function, since it only stores the pointer, not the whole function object.

Only capture-less lambdas can be passed as such arguments, since they have the conversion operator that converts to a function pointer.
http://en.cppreference.com/w/cpp/language/lambda -- see ClosureType::operator ret(*)(params)()

In such cases compiler simply generates a bare struct with the call operator and this conversion operator, since it has no state to manage because nothing is captured. You'd basically be able to call the struct's call operator as if it was any other static non-method function. If anything is captured, then lambda implies an actual object of that helper struct type, generating all the relevant constructors and destructors, plus you have to address the lifetime management (limited to scope or storable to std::function<> for delayed use).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160602/81cfea3c/attachment.html>


More information about the webkit-unassigned mailing list