Skip to content

Instantly share code, notes, and snippets.

@svyatogor
Created August 23, 2015 16:10
Show Gist options
  • Save svyatogor/eeca3a3d8ddc5633b7cf to your computer and use it in GitHub Desktop.
Save svyatogor/eeca3a3d8ddc5633b7cf to your computer and use it in GitHub Desktop.
Crash in Xcode 7b5 on corefoundation object autorelease
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
rootViewController = UIViewController.alloc.init
rootViewController.title = 'cftest'
rootViewController.view.backgroundColor = UIColor.whiteColor
navigationController = UINavigationController.alloc.initWithRootViewController(rootViewController)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = navigationController
@window.makeKeyAndVisible
h = test
true
end
def test
# Get access to contacts — irrelevant for the test itself.
ab = ABAddressBookCreateWithOptions(nil, nil)
access_callback = lambda { |granted, error| @address_book_access_granted = granted }
ABAddressBookRequestAccessWithCompletion ab, access_callback
sleep 0.1 while @address_book_access_granted.nil?
@address_book_access_granted
people = ABAddressBookCopyArrayOfAllPeople(ab)
ABRecordCopyValue(people[0], KABPersonFirstNameProperty)
# Xcode 7b5 version: CFBridgingRetain ABRecordCopyValue(people[0], KABPersonFirstNameProperty)
end
end
@svyatogor
Copy link
Author

Crash:

* thread #1: tid = 0x28bbf9, 0x00000001058a76e0 libsystem_malloc.dylib`malloc_error_break, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
  * frame #0: 0x00000001058a76e0 libsystem_malloc.dylib`malloc_error_break
    frame #1: 0x00000001058a8b23 libsystem_malloc.dylib`free + 314
    frame #2: 0x00000001002663cb libobjc.A.dylib`object_dispose + 30
    frame #3: 0x0000000100270afe libobjc.A.dylib`objc_object::sidetable_release(bool) + 232
    frame #4: 0x00000001002710b8 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 488
    frame #5: 0x0000000105bdf7b4 FrontBoardServices`-[FBSSerialQueue _performNext] + 200
    frame #6: 0x0000000105bdfb1a FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 45
    frame #7: 0x0000000102e87b21 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #8: 0x0000000102e7da4c CoreFoundation`__CFRunLoopDoSources0 + 556
    frame #9: 0x0000000102e7cf03 CoreFoundation`__CFRunLoopRun + 867
    frame #10: 0x0000000102e7c918 CoreFoundation`CFRunLoopRunSpecific + 488
    frame #11: 0x0000000100980d2d UIKit`-[UIApplication _run] + 402
    frame #12: 0x000000010098599e UIKit`UIApplicationMain + 171
    frame #13: 0x000000010000a9ef cftest`main(argc=1, argv=0x00007fff5fbfe060) + 111 at main.mm:15
    frame #14: 0x00000001056d992d libdyld.dylib`start + 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment