KVO crash notifying deallocated observer

Originator:kimtsi
Number:rdar://15985376 Date Originated:02/04/2014
Status:Open Resolved:
Product:iOS Product Version:7.1beta5
Classification:Crash Reproducible:Always
 
Summary:
KVO crash notifying deallocated observer

Steps to Reproduce:
1. Create observer and observe object.property on Thread 1.
2. Mutate object.property on Thread 2.
3. Unobserve object.property and dealloc observer on Thread 1.
4. Repeat Steps 1-3.

1. Run Sample app attached.

Expected Results:
No crash.

Actual Results:
2014-02-04 15:56:00.469 FBKVOController[78158:1303] *** -[FBKVOController retain]: message sent to deallocated instance 0x6fd366fd0

(lldb) bt all
  thread #1: tid = 0x1ef872, 0x00000001022c3a1a libsystem_kernel.dylib`mach_msg_trap + 10, queue = 'com.apple.main-thread
    frame #0: 0x00000001022c3a1a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00000001022c2d18 libsystem_kernel.dylib`mach_msg + 64
    frame #2: 0x0000000101aa7255 CoreFoundation`__CFRunLoopServiceMachPort + 181
    frame #3: 0x0000000101aac7cf CoreFoundation`__CFRunLoopRun + 1199
    frame #4: 0x0000000101aabf33 CoreFoundation`CFRunLoopRunSpecific + 467
    frame #5: 0x0000000103c083a0 GraphicsServices`GSEventRunModal + 161
    frame #6: 0x000000010026e043 UIKit`UIApplicationMain + 1010
    frame #7: 0x0000000100002143 FBKVOController`main(argc=1, argv=0x00007fff5fbfec30) + 115 at main.m:16
    frame #8: 0x00000001021905fd libdyld.dylib`start + 1

  thread #2: tid = 0x1ef97c, 0x00000001022c8662 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager
    frame #0: 0x00000001022c8662 libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x0000000101ed5590 libdispatch.dylib`_dispatch_mgr_invoke + 239
    frame #2: 0x0000000101ed532d libdispatch.dylib`_dispatch_mgr_thread + 54

* thread #3: tid = 0x1ef97d, 0x0000000101af2fd4 CoreFoundation`___forwarding___ + 772, queue = 'com.apple.root.high-priority, stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x0000000101af2fd4 CoreFoundation`___forwarding___ + 772
    frame #1: 0x0000000101af2c48 CoreFoundation`_CF_forwarding_prep_0 + 120
    frame #2: 0x000000010120cf14 Foundation`NSKeyValuePushPendingNotificationPerThread + 363
    frame #3: 0x000000010120c836 Foundation`NSKeyValueWillChange + 453
    frame #4: 0x00000001011d00c3 Foundation`-[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 221
    frame #5: 0x00000001011a85e5 Foundation`_NSSetDoubleValueAndNotify + 105
    frame #6: 0x0000000100001bd3 FBKVOController`__24-[FBAppDelegate _stress]_block_invoke(.block_descriptor=<unavailable>) + 67 at FBAppDelegate.m:26
    frame #7: 0x0000000101ecf8c1 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #8: 0x0000000101ee26fd libdispatch.dylib`_dispatch_client_callout + 8
    frame #9: 0x0000000101ed2b7d libdispatch.dylib`_dispatch_root_queue_drain + 362
    frame #10: 0x0000000101ed2d65 libdispatch.dylib`_dispatch_worker_thread2 + 40
    frame #11: 0x000000010228cef8 libsystem_pthread.dylib`_pthread_wqthread + 314
    frame #12: 0x000000010228ffb9 libsystem_pthread.dylib`start_wqthread + 13

  thread #4: tid = 0x1ef97e, 0x00000001022c3942 libsystem_kernel.dylib`_kernelrpc_mach_vm_allocate_trap + 10, queue = 'com.apple.root.high-priority
    frame #0: 0x00000001022c3942 libsystem_kernel.dylib`_kernelrpc_mach_vm_allocate_trap + 10
    frame #1: 0x00000001022c6783

Version:
iOS 7.0.3 (11B508)

Notes:


Configuration:
Xcode 5.0.2 (5A3005), OS X 10.9.1, MacBook Pro

Attachments:
'MacBook Pro.spx' and 'FBKVOController.zip' were successfully uploaded.

Attachment URL:
https://dl.dropboxusercontent.com/u/1898287/rdar/15985376/FBKVOController.zip

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!