New issue
Advanced search Search tips

Issue 768414 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: ----



Sign in to add a comment

Annotate or remove gfx::Image::CopyUIImage()

Project Member Reported by tgarbus@google.com, Sep 25 2017

Issue description

CopyUIImage() method of gfx::Image doesn't work well with ARC.
Add correct annotation (__attribute__((ns_returns_retained))) or remove it. It is not used anywhere (apart from its own unittests).

https://cs.chromium.org/chromium/src/ui/gfx/image/image.h
 
Status: Assigned (was: Unconfirmed)
Project Member

Comment 2 by bugdroid1@chromium.org, Oct 2 2017

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

commit 3affc995ae9b4b22fac9f3fa65e9aebeefa837f2
Author: Sylvain Defresne <sdefresne@chromium.org>
Date: Mon Oct 02 19:14:50 2017

Remove unsafe gfx::Image CopyUIImage method.

CopyUIImage used to return a retaine UIImage* without any
annotation about memory management. As compiler only use
the naming heuristic for Objective-C method and not for C
or C++ functions nor methods, this result in memory leaks
if called from a file compiled with ARC.

Since (almost) all of iOS code has been converted to use
ARC, remove the method (ToUIImage should be used instead).

Fix a memory leak in image_unittest_util.cc that called
CopyUIImage (via CopyPlatformType) to then pass the value
to gfx::Image constructor (that retains the value).

Bug:  768414 
Change-Id: I66fcb40832630da94055bfe8ea15efe70abf8f70
Reviewed-on: https://chromium-review.googlesource.com/690001
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505710}
[modify] https://crrev.com/3affc995ae9b4b22fac9f3fa65e9aebeefa837f2/ui/gfx/image/image.cc
[modify] https://crrev.com/3affc995ae9b4b22fac9f3fa65e9aebeefa837f2/ui/gfx/image/image.h
[modify] https://crrev.com/3affc995ae9b4b22fac9f3fa65e9aebeefa837f2/ui/gfx/image/image_unittest.cc
[modify] https://crrev.com/3affc995ae9b4b22fac9f3fa65e9aebeefa837f2/ui/gfx/image/image_unittest_util.cc
[modify] https://crrev.com/3affc995ae9b4b22fac9f3fa65e9aebeefa837f2/ui/gfx/image/image_unittest_util.h

Status: Fixed (was: Assigned)

Sign in to add a comment