8000 Fix chapter list not updating and/or crashing (issue #4696) by svobs · Pull Request #4697 · iina/iina · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix chapter list not updating and/or crashing (issue #4696) #4697

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

Merged
merged 2 commits into from
Jan 2, 2024

Conversation

svobs
Copy link
Contributor
@svobs svobs commented Nov 25, 2023

Description:

  • Removes bad code from PlayerCore.getChapters() which returned early when chapter count == 0. This resulted in chapter list not getting updated in this situation.
  • Fix crash by adding checks whether index is valid into chapters array wherever it is referenced.
  • Generally fix potential concurrency pitfalls relating to chapters list (see comments in code).
  • Chapter list reload triggers table reload. Not the other way around.

@@ -206,9 +206,8 @@ class PlaySliderCell: NSSliderCell {
if let totalSec = info.videoDuration?.second {
chapterStrokeColor.setStroke()
var chapters = info.chapters
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var chapters = info.chapters
let chapters = info.chapters

let chapter = player.info.chapters[index]
guard let chapter = player.playChapter(index) else {
Logger.log("Cannot switch to chapter \(index) because it was not found! Will ignore request and reload chapters instead",
level: .error, subsystem: player.subsystem)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think error is too strong for this situation. The user can trigger this. IINA recovers. There isn't an error that needs to be corrected. I would emit this as a debug level message.

Copy link
Contributor
@low-batt low-batt left a comment

Choose a reason for hiding this comment

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

Pulled PR, tested, confirmed crash no longer happens.

The variable in PlaySliderCell should be changed to be a let constant to correct a new compiler warning.

I would change the log level of that one message although that is not critical.

@svobs svobs force-pushed the pr-fix-chapter-crash branch from f15f8ad to 70856bd Compare December 26, 2023 04:17
@svobs
Copy link
Contributor Author
svobs commented Dec 26, 2023

The variable in PlaySliderCell should be changed to be a let constant to correct a new compiler warning.
I would change the log level of that one message although that is not critical.

Done. Committed (also rebased). In the XCode 15 release notes, I saw this:

Fixed an issue where build warnings in Swift files sometimes disappeared after an incremental build.
 (105421512)

Doesn't seem to be fixed in all cases, unfortunately.

Copy link
Contributor
@low-batt low-batt left a comment

Choose a reason for hiding this comment

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

All looks good to me.

@low-batt
Copy link
Contributor

I have experienced that Xcode behavior where warnings are not shown as well. Very frustrating.

PRs are being merged for a 1.3.4 release. The main focus of this release is the switch to Open Subtitle's REST API as the old API is shutting down at the end of the year. This PR is on the list for that release.

@uiryuu uiryuu merged commit f97a5d5 into iina:develop Jan 2, 2024
@uiryuu
Copy link
Member
uiryuu commented Jan 2, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep the chapter menu on and play the next video, the menu is unchanged, and IINA crashes when clicking on the menu for navigation
3 participants
0