Skip to content

Fix a crash adding several files at once, from #535 - #536

Merged
kddlb merged 1 commit into
mainfrom
playlist-loader-url-for-path
Oct 6, 2026
Merged

kddlb merged 1 commit into
mainfrom
playlist-loader-url-for-path

Conversation

@kddlb

@kddlb kddlb commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

#535 moved the C function urlForPath() from PlaylistEntry.m into CogPlaylist, as the Swift PlaylistEntry.url(forPath:). But two files declared the C function themselves and still called it:

  • PlaylistLoader.m, in loadInfoForEntries:;
  • SQLiteStore.m, in its import of the old library.

The Cog target links with -undefined dynamic_lookup, so the build passed. The call fails only when it's reached, and dyld aborts the app. loadInfoForEntries: is the background metadata load: adding several files at once loads the first in the foreground and the rest there, so adding more than one file at a time crashes main today. My testing of #535 added files one at a time and from cue sheets, neither of which reaches it. Sorry about that.

The fix exposes the Swift version to Objective-C as +[PlaylistEntry urlForPath:]; both callers use it, and the stale declarations go.

Testing

  • The app builds. nm -u on Cog.debug.dylib no longer lists _urlForPath.
  • Compared with a build from just before CogPlaylist, step 1: the framework, and PlaylistEntry's shared logic in Swift #535, the only new undefined non-Swift symbols are PlaylistEntry and PlaylistStore's classes, and CogPlaylist.framework exports both. Nothing else dangles.
  • A new test calls urlForPath: the way Objective-C does. All 28 CogPlaylist tests pass.
  • Not yet run in the app: adding several files at once is the check.

🤖 Generated with Claude Code

… urlForPath:]

The C function urlForPath() went with the rest of PlaylistEntry's URL code
to CogPlaylist in 2f51353, but PlaylistLoader and SQLiteStore declared it
themselves and still called it. The app links with -undefined
dynamic_lookup, so the build passed, and the call failed when it was
reached: loading metadata in the background, as adding several files at
once does, aborted the app, as would SQLiteStore's import of the old
library.

The Swift port of it is now visible to Objective-C as
+[PlaylistEntry urlForPath:], and both call it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@kddlb
kddlb merged commit 497eb4a into main Oct 6, 2026
1 check passed
@kddlb
kddlb deleted the playlist-loader-url-for-path branch October 6, 2026 11:24
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.

1 participant