Chromium Code Reviews
DescriptionFix bug of posting task inside constructor
Refcounted object is initialized to have zero refcount and will be increased
to 1 in RefCountedThreadSafe::operator=(). There is a chance that
ConnectToHost finishes earlier than operator=(), which drops the refcount to
0 and triggers the d'tor.
Adding sleep(1) after PostTask() shows stable repro of this problem.
This CL fixes this problem by pulling the PostTask code out of the ctor.
BUG=615288
Review-Url: https://codereview.chromium.org/2023113002
Cr-Commit-Position: refs/heads/master@{#396961}
(cherry picked from commit 35c9e62b75248238526386edc44c46794adac095)
Committed: https://chromium.googlesource.com/chromium/src/+/c6ab1822890f8eebdf8aca40a26b4715518a4767
Patch Set 1 #
Messages
Total messages: 2 (1 generated)
|
|||||||||||||||||||||||||||||||||||||