Bug 281835

Summary: UniqueRef<T>::operator-> shouldn't return a const T*
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: Web Template FrameworkAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Jean-Yves Avenard [:jya]
Reported 2024-10-20 02:44:48 PDT
UniqueRef<T> is supposed to operate like a std::unique_ptr<T> which is never null. But both its `operator->()` and `operator*()` return a const object, unlike std::unique_ptr<T> equivalent that will return a non const object (just like a T* type would) This prevents `const UniqueRef<T>` from being commonly use, which not only indicates that it will never be null, but that it also will never be modified during the lifetime of its `this` parent.
Attachments
Radar WebKit Bug Importer
Comment 1 2024-10-20 02:45:10 PDT
Chris Dumez
Comment 2 2024-10-20 16:51:34 PDT
Seems like a good change. This difference between unique_ptr and UniqueRef makes switching from one to the other more painful than it needs to be. This would also align UniqueRef with RefPtr / Ref.
Jean-Yves Avenard [:jya]
Comment 3 2024-10-23 02:51:37 PDT
EWS
Comment 4 2024-10-23 16:39:28 PDT
Committed 285628@main (c684d1a74a2b): <https://commits.webkit.org/285628@main> Reviewed commits have been landed. Closing PR #35614 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.