Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This repository was archived by the owner on May 28, 2025. It is now read-only.

UIImage::applicationImageNamed:(NSString*)pathAddr Broken #1292

@MSFTFox

Description

@MSFTFox

UIImage is using a bad initialization pattern for this method. It attempts to call alloc/init and if that fails, will call init again on the alloc'd object.

UIImage* ret = [UIImage alloc];
UIImage* found = [ret initWithContentsOfFile:pathAddr];

if (found == nil) {
...
found = [ret initWithData:fileData scale:scale];

This is obviously a bad pattern and was only working due to a design flaw in initWithContentsOfFile that was fixed with a change by @bbowman.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions