0

Occasionally, I'm seeing crashes originating from the -dealloc in SPTrack:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xb1e8ded2
Crashed Thread:  13

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_c.dylib               0x39bb8d5c memset$VARIANT$CortexA9 + 100
1   CoreFoundation                  0x35e1a7fc __CFAllocateObjectArray + 176
2   CoreFoundation                  0x35d62118 _CFXNotificationRemoveObservers + 420
3   Foundation                      0x33834490 -[NSNotificationCenter removeObserver:name:object:] + 228
4   MyAppName                       0x00179fd0 -[SPTrack dealloc] (SPTrack.m:291)
5   MyAppName                       0x0017993a __destroy_helper_block_141 (SPTrack.m:223)
6   libsystem_blocks.dylib          0x352adab0 _Block_release + 220
7   libdispatch.dylib               0x34b064b4 _dispatch_client_callout + 20
8   libdispatch.dylib               0x34b0b1b8 _dispatch_main_queue_callback_4CF$VARIANT$mp + 220
9   CoreFoundation                  0x35de9f36 __CFRunLoopRun + 1286
10  CoreFoundation                  0x35d5ceb8 CFRunLoopRunSpecific + 352
11  CoreFoundation                  0x35d5cd44 CFRunLoopRunInMode + 100
12  GraphicsServices                0x362992e6 GSEventRunModal + 70
13  UIKit                           0x3713b2fc UIApplicationMain + 1116
14  MyAppName                       0x0005e986 main (main.m:14)
15  MyAppName                       0x0001d8e4 start + 36

This is what's on #291 in SPTrack:

[[NSNotificationCenter defaultCenter] removeObserver:self name:SPSessionDidUpdateMetadataNotification object:self.session];

This generally happens when I bring the app back from the background.

Any ideas to what the cause could be? Is it trying to remove the observer more than once? Or could self.session be invalid? (Haven't been able to catch it with the debugger.)

Kristofer Sommestad
  • 3,061
  • 27
  • 39
  • 1
    This looks like a bug unless you're doing something super crazy. I added a commit to CocoaLibSpotify's `dev` branch that makes it more robust if your theory is true (it sounds like a sensible theory). As you said, it's hard to debug without a full trace. I'll keep an eye out for it! – iKenndac Sep 27 '12 at 12:00
  • Thanks. I'll cherry-pick the commit and see if it goes away. – Kristofer Sommestad Sep 27 '12 at 12:02
  • Haven't seen this error since I updated according to the patch! – Kristofer Sommestad Sep 30 '12 at 21:50

1 Answers1

0

After cherry-picking this commit in CocoaLibSpotify (as per iKenndac's suggestion), I'm no longer getting these crashes.

Kristofer Sommestad
  • 3,061
  • 27
  • 39