Bug 184405

Summary: [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebCore Misc.Assignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, commit-queue, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=176490
Attachments:
Description Flags
Patch none

Michael Catanzaro
Reported 2018-04-08 18:36:04 PDT
WlUniquePtr<wl_display> is a pretty big footgun because there are two different destruction functions -- wl_display_disconnect() and wl_display_destroy() -- and which one you need to use depends on how the wl_display() was created, and WebKit uses both in different places. So WlUniquePtr<wl_display> is pretty unsafe. See bug #176490 for an example of fun caused by using it incorrectly. Let's use std::unique_ptr with custom deleter functors instead. Suggestions for how to do this better (without giving up RAII) are quite welcome.
Attachments
Patch (4.69 KB, patch)
2018-04-08 18:52 PDT, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2018-04-08 18:52:01 PDT
Carlos Garcia Campos
Comment 2 2018-04-23 07:18:12 PDT
Comment on attachment 337474 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337474&action=review > Source/WebKit/UIProcess/gtk/WaylandCompositor.h:129 > + void operator() (struct wl_display* display) { wl_display_destroy(display); } const
Michael Catanzaro
Comment 3 2018-04-23 17:40:43 PDT
Comment on attachment 337474 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337474&action=review >> Source/WebKit/UIProcess/gtk/WaylandCompositor.h:129 >> + void operator() (struct wl_display* display) { wl_display_destroy(display); } > > const const seems pretty overkill for a function object with no member variables :)
WebKit Commit Bot
Comment 4 2018-04-23 18:07:11 PDT
Comment on attachment 337474 [details] Patch Clearing flags on attachment: 337474 Committed r230936: <https://trac.webkit.org/changeset/230936>
WebKit Commit Bot
Comment 5 2018-04-23 18:07:13 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6 2018-04-23 18:08:25 PDT
Note You need to log in before you can comment on or make changes to this bug.