SubmarinerApp / Submariner

A Subsonic client for macOS
https://submarinerapp.com
BSD 3-Clause "New" or "Revised" License
130 stars 3 forks source link

App crashes when clicking on artist loaded from server - Version 3.1.1 (3.1.1) via Brew #214

Closed johnflan closed 11 hours ago

johnflan commented 1 month ago

Describe the bug After connecting to a Navidrome server, the artists list populates - when I click on any artist the app hard crashes.

To Reproduce Steps to reproduce the behavior:

  1. Add remote Navidrome server
  2. Once artists names are loaded in the list click on any
  3. App crashes

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Versions:

Additional context

2024-07-20 23:20:10.483 Submariner[77089:5570521] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[NSNib _initWithNibNamed:bundle:options:] could not load the nibName: SBAlbumViewItem in bundle NSBundle </Applications/Submariner.app> (loaded).'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007ff80d50c6b3 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff80d26c8bb objc_exception_throw + 48
    2   CoreFoundation                      0x00007ff80d50c51a +[NSException exceptionWithName:reason:userInfo:] + 0
    3   AppKit                              0x00007ff80ff271bb -[NSNib _initWithNibNamed:bundle:options:] + 634
    4   AppKit                              0x00007ff80ff26efa -[NSViewController _nibWithName:bundle:] + 173
    5   AppKit                              0x00007ff810840352 -[NSCollectionViewItem _nibWithName:bundle:] + 101
    6   AppKit                              0x00007ff80ff26b1c -[NSViewController loadView] + 131
    7   Submariner                          0x000000010e8b4b6e Submariner + 686958
    8   AppKit                              0x00007ff80ff26939 -[NSViewController _loadViewIfRequired] + 72
    9   AppKit                              0x00007ff80ff268b6 -[NSViewController view] + 23
    10  Submariner                          0x000000010e8b4834 Submariner + 686132
    11  Submariner                          0x000000010e8b4dd2 Submariner + 687570
    12  Submariner                          0x000000010e8b4cfa Submariner + 687354
    13  Submariner                          0x000000010e82894f Submariner + 112975
    14  AppKit                              0x00007ff8100c7612 -[_NSCollectionViewDataSourceAdapter collectionView:itemForRepresentedObjectAtIndexPath:] + 438
    15  UIFoundation                        0x00007ff810d6bca5 -[_NSCollectionViewCore _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 100
    16  UIFoundation                        0x00007ff810d6bc3b -[_NSCollectionViewCore _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 31
    17  UIFoundation                        0x00007ff810d5426b -[_NSCollectionViewCore _updateVisibleCellsNow:] + 4354
    18  UIFoundation                        0x00007ff810d4913e -[_NSCollectionViewCore _layoutItems] + 271
    19  UIFoundation                        0x00007ff810e2a83f -[_NSCollectionViewCore _itemAtIndexPath:includePrefetchedCells:] + 240
    20  UIFoundation                        0x00007ff810e24323 __74-[_NSCollectionViewCore _selectItemsAtIndexPaths:animated:notifyDelegate:]_block_invoke + 37
    21  CoreFoundation                      0x00007ff80d4c07a0 __NSSET_IS_CALLING_OUT_TO_A_BLOCK__ + 7
    22  CoreFoundation                      0x00007ff80d504040 -[__NSSingleObjectSetI enumerateObjectsWithOptions:usingBlock:] + 111
    23  UIFoundation                        0x00007ff810e242b0 -[_NSCollectionViewCore _selectItemsAtIndexPaths:animated:notifyDelegate:] + 388
    24  AppKit                              0x00007ff810842d35 -[NSCollectionView _selectItemsAtIndexPaths:scrollPosition:notifyDelegate:] + 152
    25  AppKit                              0x00007ff81084354d -[NSCollectionView setSelectionIndexPaths:] + 232
    26  AppKit                              0x00007ff810267d7d -[NSCollectionView setSelectionIndexes:] + 171
    27  Submariner                          0x000000010e826657 Submariner + 104023
    28  Foundation                          0x00007ff80e2c1f3a NSKeyValueNotifyObserver + 306
    29  Foundation                          0x00007ff80e2bc524 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 914
    30  AppKit                              0x00007ff80feabc08 -[NSController _notifyObserversForKeyPath:change:] + 188
    31  AppKit                              0x00007ff80ff4b9e1 -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:] + 53
    32  AppKit                              0x00007ff80ff4a619 -[NSArrayController setContent:] + 682
    33  AppKit                              0x00007ff810110f72 -[NSArrayDetailBinder _refreshDetailContentInBackground:] + 1209
    34  Foundation                          0x00007ff80e2c1f3a NSKeyValueNotifyObserver + 306
    35  Foundation                          0x00007ff80e2bc524 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 914
    36  AppKit                              0x00007ff80feabc08 -[NSController _notifyObserversForKeyPath:change:] + 188
    37  AppKit                              0x00007ff80feda46b -[NSController observeValueForKeyPath:ofObject:change:context:] + 814
    38  AppKit                              0x00007ff8101199b4 -[NSArrayController observeValueForKeyPath:ofObject:change:context:] + 98
    39  Foundation                          0x00007ff80e2c1f3a NSKeyValueNotifyObserver + 306
    40  Foundation                          0x00007ff80e385f99 NSKeyValueDidChange + 431
    41  Foundation                          0x00007ff80e42e7ce NSKeyValueDidChangeWithPerThreadPendingNotifications + 146
    42  CoreData                            0x00007ff813459766 -[NSManagedObjectContext _mergeRefreshObject:mergeChanges:withPersistentSnapshot:] + 1302
    43  CoreData                            0x00007ff813426581 -[NSManagedObjectContext _mergeChangesFromDidSaveDictionary:usingObjectIDs:] + 4705
    44  CoreData                            0x00007ff8134252da -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:] + 426
    45  Submariner                          0x000000010e8482ae Submariner + 242350
    46  Submariner                          0x000000010e8a7e39 Submariner + 634425
    47  libdispatch.dylib                   0x00007ff80d2110cc _dispatch_call_block_and_release + 12
    48  libdispatch.dylib                   0x00007ff80d212317 _dispatch_client_callout + 8
    49  libdispatch.dylib                   0x00007ff80d21ec78 _dispatch_main_queue_drain + 943
    50  libdispatch.dylib                   0x00007ff80d21e8bb _dispatch_main_queue_callback_4CF + 31
    51  CoreFoundation                      0x00007ff80d4cee47 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    52  CoreFoundation                      0x00007ff80d48fedf __CFRunLoopRun + 2771
    53  CoreFoundation                      0x00007ff80d48ed4c CFRunLoopRunSpecific + 562
    54  HIToolbox                           0x00007ff8161425e6 RunCurrentEventLoopInMode + 292
    55  HIToolbox                           0x00007ff81614234a ReceiveNextEventCommon + 594
    56  HIToolbox                           0x00007ff8161420e5 _BlockUntilNextEventMatchingListInModeWithFilter + 70
    57  AppKit                              0x00007ff80fecdaa9 _DPSNextEvent + 927
    58  AppKit                              0x00007ff80fecc166 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1394
    59  AppKit                              0x00007ff80febe818 -[NSApplication run] + 586
    60  AppKit                              0x00007ff80fe9279a NSApplicationMain + 817
    61  Submariner                          0x000000010e83eb8c Submariner + 203660
    62  dyld                                0x000000011d51752e start + 462
)
libc++abi: terminating with uncaught exception of type NSException
[1]    77089 abort      /Applications/Submariner.app/Contents/MacOS/Submariner
NattyNarwhal commented 1 month ago

I can reproduce this (and another issue) on a system running 12. It looks like it's trying to load a nib (which doesn't exist, because we generate the view programatically).

I wonder if it's related to not calling registerClass:forItemWithIdentifier:- I had issues using the makeItemWithIdentifier:forIndexPath: method and instead instantiated a new object every time. It felt gross, but it did work at least when I was testing on 14.

NattyNarwhal commented 1 month ago

One thing I am noticing with NSCollectionViewItem subclasses is they shouldn't be calling super loadView; I'm guessing that's what hits the nib initialization logic (which is perhaps less fatal on newer version).

NattyNarwhal commented 1 month ago

It looks like it's indeed calling super.loadView() that causes the problem. If I don't call that:

Screenshot 2024-07-21 at 5 01 27 PM

There's some other issues on 12 I need to take a look at though. Once I do that, I'll push an update. If you don't mind compiling yourself though, master should be fine now.

morbificagent commented 3 days ago

Same here... even with 3.2

Would be great to get this working.

NattyNarwhal commented 3 days ago

The fixes are committed, but I haven't pushed a release yet because I've been busy. I'll try to do so this week.

NattyNarwhal commented 11 hours ago

This should be fixed in 3.2.1. App Store and brew will need updates, I've pushed it for App Store review.