WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
185239
Widgets should hold a WeakPtr to their parents
https://bugs.webkit.org/show_bug.cgi?id=185239
Summary
Widgets should hold a WeakPtr to their parents
Brent Fulgham
Reported
2018-05-02 22:51:45 PDT
We don't have a parent/child destruction notification mechanism for Widgets and their enclosing ScrollViews. We should allow the Widget to hold a WeakPtr to the parent ScrollView so we can gracefully handle cases where the ScrollView has been removed from the current document by the Widget is still pending a final move operation.
Attachments
Patch
(4.14 KB, patch)
2018-05-02 23:26 PDT
,
Brent Fulgham
zalan
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Brent Fulgham
Comment 1
2018-05-02 22:53:38 PDT
<
rdar://problem/39741250
>
Brent Fulgham
Comment 2
2018-05-02 23:26:27 PDT
Created
attachment 339390
[details]
Patch
zalan
Comment 3
2018-05-03 06:45:03 PDT
Comment on
attachment 339390
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=339390&action=review
> Source/WebCore/platform/Widget.cpp:37 > + m_parent = nullptr;
No need to null the weak ptr; unless we call init() outside of the object construction.
> Source/WebCore/platform/Widget.cpp:50 > + m_parent = view ? view->createWeakPtr() : nullptr;
I'd rather use makeWeakPtr() helper here (with auto& weakPtrFactory() const { return m_weakFactory; } on the ScrollView.)
Brent Fulgham
Comment 4
2018-05-03 16:51:16 PDT
Committed
r231335
: <
https://trac.webkit.org/changeset/231335
>
zalan
Comment 5
2018-05-03 16:53:52 PDT
>m_parent = view ? makeWeakPtr(*view) : nullptr;
You could just do m_parent = makeWeakPtr(view); instead. makeWeakPtr handles nullptr.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug