New issue
Advanced search Search tips

Issue 822421 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Dec 21
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

base::linked_ptr could probably use a move ctor/move assign operator from unique_ptr<>&&

Project Member Reported by tsepez@chromium.org, Mar 15 2018

Issue description

https://cs.chromium.org/search/?q=linked_ptr.*release&sq=package:chromium&type=cs shows a bunch of places where ownership is passed from an unique_ptr to a linked_ptr, eg. like this code from event_router.cc

void EventRouter::BroadcastEvent(std::unique_ptr<Event> event) {
  DispatchEventImpl(std::string(), linked_ptr<Event>(event.release()));
}

Calling release() should always be a red flag, instead, I'd like to write

void EventRouter::BroadcastEvent(std::unique_ptr<Event> event) {
  DispatchEventImpl(std::string(), linked_ptr<Event>(std::move(event)));
}
 

Comment 1 by tsepez@chromium.org, Mar 15 2018

In fact, we might consider getting rid of all forms that take a T* raw ptr, so as to prove ownership of the object being passed in via having an unique ptr to it.
Owner: a...@chromium.org
Status: WontFix (was: Untriaged)
Nooooope.

linked_ptr is dying, due to me killing it. We are not making it any better, only making it deader.

See  bug 556939 .

Sign in to add a comment