Fix double-delete in ResolveProxyMsgHelper.
The class is reference counted, and makes a mojo call, with a callback, on the UI thread. The callback was passed a raw pointer to the class, but when it was invoked, it grabbed a reference to the class. When the class's last reference is released, it posts a delete task to the UI thread. So if the class's last reference was released, and then it received a a Mojo callback, there would be a pending delete task, we'd grab a new ref (Increasing the refcount from 0 to 1), the delete task would run, and then a new delete task would be posted when the reference went to 0 again, resulting in a double-delete. This CL fixes that by making the class keep a reference to itself whebever there's a pending mojo callback. MessageFilters are designed to be able to call Send() after the class they want to send messages to has been deleted, so the increased lifetime is completely safe. Bug: 870675 Change-Id: I64f6656e61dc9222a67cd40555d3dd73fb48e208 Reviewed-on: https://chromium-review.googlesource.com/1161967 Commit-Queue: Matt Menke <mmenke@chromium.org> Reviewed-by:John Abd-El-Malek <jam@chromium.org> Reviewed-by:
Eric Roman <eroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#580932}
Showing
This diff is collapsed.
Please register or sign in to comment