Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xcode 9 beta 5] Fixed an issue causing infinite recursion in the Swift runtime. #3498

Merged
merged 3 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# master
*Please put new entries at the top.

1. [Xcode 9 beta 5] Fixed an issue causing infinite recursion in the Swift runtime. (#3498, kudos to @andersio)

# 6.0.0
# 6.0.0-rc.3
# 6.0.0-rc.2
Expand Down
2 changes: 1 addition & 1 deletion ReactiveCocoa/ObjC+RuntimeSubclassing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private func subclassName(of class: AnyClass) -> String {
/// - class: The class to swizzle.
/// - perceivedClass: The class to be reported by the methods.
private func replaceGetClass(in class: AnyClass, decoy perceivedClass: AnyClass) {
let getClass: @convention(block) (Any) -> AnyClass = { _ in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this cause infinite recursion? 😕

Copy link
Member Author

@andersio andersio Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stack is overflown by an infinite recursion of Swift._bridgeAnyObjectToAny. We shouldn't have used Any here anyway.

Copy link
Member Author

@andersio andersio Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen shot 2017-08-10 at 1 54 52 am

Presumably since beta 5 the bridging call relies on -class and +class, which in turns require bridging due to the use of Any.

let getClass: @convention(block) (UnsafeRawPointer?) -> AnyClass = { _ in
return perceivedClass
}

Expand Down