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

[SR-2417] Crash in IndexPath._unconditionallyBridgeFromObjectiveC in UICollectionView #45022

Closed
bobergj opened this issue Aug 19, 2016 · 15 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution standard library Area: Standard library umbrella

Comments

@bobergj
Copy link

bobergj commented Aug 19, 2016

Previous ID SR-2417
Radar None
Original Reporter @bobergj
Type Bug
Status Closed
Resolution Invalid

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, RunTimeCrash
Assignee None
Priority Medium

md5: 6878f5e47575efe69a535677c3bf1d7d

relates to:

  • SR-2103 Crash in IndexPath._unconditionallyBridgeFromObjectiveC

Issue Description:

I get the crash in

@bobergj
Copy link
Author

bobergj commented Aug 19, 2016

Xcode 8.0 beta 6 (8S201h). tvOS. I could only see this one when UICollectionView prefetching is enabled.

@belkadan
Copy link
Contributor

Can you attach your project, or a smaller test case?

(It's also possible you're being passed nil, and the method is annotated incorrectly. In that case, we'll file a Radar and pass it on to the UIKit folks.)

@bobergj
Copy link
Author

bobergj commented Aug 22, 2016

I've attached a sample project, see IndexPathBridgeCrash.zip.
How to reproduce crash using this project:

  1. Launch in Apple TV simulator
  2. Scroll down

@belkadan
Copy link
Contributor

It looks like a UIKit bug. The index path is nil, but I'm not sure why. Do you want to file the Radar, so that you can track when it's fixed, or would you like me to do it?

@bobergj
Copy link
Author

bobergj commented Aug 24, 2016

Filed Radar 27981831

@belkadan
Copy link
Contributor

Thanks. I'm going to close this, since there's not much we can do on the Swift side.

@swift-ci
Copy link
Collaborator

Comment by Ryan Grier (JIRA)

@bobergj Can you post your radar to open radar? I'd love to file a dup. I am running into this same issue.

I've experienced a very similar crash log without prefecting enabled.

@swift-ci
Copy link
Collaborator

Comment by Koushik Karmakar (JIRA)

I'm facing a similar issue in UITableView

@belkadan
Copy link
Contributor

Please file a Radar for each mis-annotated API you find. There's also an Xcode 8.1 release note that demonstrates how you can work around this sort of issue.

@swift-ci
Copy link
Collaborator

Comment by Christophe Braud (JIRA)

I guest you can reopen this ticket.

My environment:

  • Xcode 8.0 (8A218a)

  • Swift 3

  • iOS 10.0.2

My application crash randomly for some users on:
> 0 libswiftFoundation.dylib 0x100ca0a18 static IndexPath.unconditionallyBridgeFromObjectiveC(NSIndexPath?) -> IndexPath (hidden#3088:239)
> 1 MyApp 0x1000c8c3c @objc ViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (ViewController.swift)
It's happen after the migration on Swift 3
From my side I have not been able to reproduce the crash in my testing

@belkadan
Copy link
Contributor

Again, this is a UIKit bug, and not something we can fix in Swift. Please file a Radar for each mis-annotated API you find—in this case, tableView(_:cellForRowAt:).

@swift-ci
Copy link
Collaborator

Comment by Tom Kraina (JIRA)

I have just run into a similar issue. Is there a workaround?

@belkadan
Copy link
Contributor

The workaround is usually just to write a wrapper function in Objective-C, which isn't a great answer. There's an example of how to handle return values or callbacks buried in the Xcode release notes. See https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW10.

@swift-ci
Copy link
Collaborator

Comment by Tom Kraina (JIRA)

Thanks. What worked for me is just to define the indexPath parameter as optional. The method gets called correctly with nil without crashes. For more info see https://openradar.appspot.com/31375101

@swift-ci
Copy link
Collaborator

Comment by Viktor Shurapov (JIRA)

tomkraina (JIRA User) Thank you so much![]( Your idea with optional indexPath works great)! :-)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

4 participants