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.

Address lack of proper nil-initialization in WinObjC compiler #1965

@jaredhms

Description

@jaredhms

There were some speculative patches for objc_msgSend, but it turns out that the compiler skips the send entirely if the target is known to be nil. We need to investigate either implementing a nil-initializer in the compiler, or make a thorough pass through the codebase to make sure we're not relying on this behavior for complex types, followed by educating the team against sending messages to nil.

For example; this call is returning a completely bogus CGRect when 'image' is nil:

CGRect stretch = [image _imageStretch];
if (!CGRectEqualToRect([layer contentsCenter], stretch)) {
     [layer setContentsCenter:stretch];
}

0:007:x86> dd &stretch
034ff37c  034ff398 09b41e9c 0ae98df8 c68a9ac4

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions