Description[iOS/ARC] Fix a violation of ODR in base::BindBlock under ARC.
The template function base::BindBlock invoked the constructor of
base::mac::ScopedBlock that has two different signature whether
ARC (automatic reference counting) is enabled or not.
If two different files are compiled with a different ARC setting
(one has ARC enabled, the other has it disabled) and both invoke
base::BindBlock with the same type of block (i.e. same signature)
then the function has two different implementation (which is a
violation of the ODR) and one of them is selected at link-time.
As the base::BindBlock implementation does retain the block, this
can only lead to over-retaining an object (as the implementation
leaks if the ARC version of base::mac::ScopedBlock is invoked) not
to over-releasing.
BUG=666027
Committed: https://crrev.com/3baab423ea642cc0851a482841091fd8ac9f8b3c
Cr-Commit-Position: refs/heads/master@{#434182}
Patch Set 1 #Patch Set 2 : Add unittest to validate the fix. #Patch Set 3 : Switch expected and actual in EXPECT_EQ. #Patch Set 4 : Use EXPECT_NSEQ instead of EXPECT_EQ/EXPECT_TRUE. #Messages
Total messages: 27 (20 generated)
|