New issue
Advanced search Search tips

Issue 853649 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 11
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Leak in extensions/ OneShotEvent

Project Member Reported by lazyboy@chromium.org, Jun 18 2018

Issue description

OneShotEvent::tasks_ is never clear (event after the OneShotEvent is Signal()ed).

This is not ideal since |tasks_| will hold references to consumers of OneShotEvent. As OneShotEvent instance in ExtensionService lives forever-ish, this can be considered a leak.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jun 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e2ea864f13a06487314df6a196dd39a554067520

commit e2ea864f13a06487314df6a196dd39a554067520
Author: Istiaque Ahmed <lazyboy@chromium.org>
Date: Mon Jun 18 22:00:12 2018

Fix a leak in OneShotEvent class.

Once Signal()ed, OneShotEvent should drop all the references to
the tasks, otherwise OneShotEvent::tasks_ would continue to hold
references to users of OneShotEvent::Post(), for the lifetime
of OneShotEvent.

This CL clears |tasks_| once Signal() is called, dropping those
references correctly. In future, OneShotEvent::Post() will take
OnceClosure instead of (repeating) Closure.

This CL also adds a regression test for the same.

Bug:  853649 
Change-Id: I10270318ff8393a9af0b8da299a1866df936b273
Reviewed-on: https://chromium-review.googlesource.com/1103606
Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568184}
[modify] https://crrev.com/e2ea864f13a06487314df6a196dd39a554067520/extensions/common/one_shot_event.cc
[modify] https://crrev.com/e2ea864f13a06487314df6a196dd39a554067520/extensions/common/one_shot_event_unittest.cc

Status: Fixed (was: Started)

Sign in to add a comment