GKGridGraph of size (1,1) crashes when autoreleased

Originator:jtbandes
Number:rdar://22754268 Date Originated:9/18/2015
Status:Open Resolved:
Product: Product Version:
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
The following code reliably produces a crash.

Steps to Reproduce:
import GameplayKit

class Broken {
    let graph: GKGridGraph
    
    init() {
        graph = GKGridGraph(fromGridStartingAt: [0, 0], width: 1, height: 1, diagonalsAllowed: false)
    }
}

var g: Broken?
autoreleasepool {
    g = Broken()
}

g = nil

Expected Results:
No crashes or errors.

Actual Results:
Playground execution failed: Execution was interrupted, reason: EXC_BAD_ACCESS (code=EXC_I386_GPFLT).
* thread #1: tid = 0x4576a, 0x0000000110d3d63f GameplayKit`-[GKGraphNode dealloc] + 31, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x0000000110d3d63f GameplayKit`-[GKGraphNode dealloc] + 31
    frame #1: 0x00007fff9ffbb2dd CoreFoundation`-[__NSArrayM dealloc] + 205
    frame #2: 0x00007fff95188b81 libobjc.A.dylib`object_cxxDestructFromClass(objc_object*, objc_class*) + 127
    frame #3: 0x00007fff95181383 libobjc.A.dylib`objc_destructInstance + 116
    frame #4: 0x00007fff951812e5 libobjc.A.dylib`object_dispose + 22
    frame #5: 0x0000000110d389d1 GameplayKit`-[GKGraph dealloc] + 65
    frame #6: 0x0000000110dc84b3 $__lldb_expr36`__lldb_expr_36.Broken.deinit(self=0x00007f81a3115c20) + 35 at <EXPR>:0
    frame #7: 0x0000000110dc8438 $__lldb_expr36`__lldb_expr_36.Broken.__deallocating_deinit + 24 at <EXPR>:0
    frame #8: 0x0000000110dc82d5 $__lldb_expr36`main + 725 at <EXPR>:0
    frame #9: 0x000000010bafd710 Gameplay`_mh_execute_header + 22288
    frame #10: 0x000000010bafeb31 Gameplay`reabstraction thunk helper from @callee_owned () -> (@unowned ()) to @callee_owned (@in ()) -> (@out ()) + 17
    frame #11: 0x000000010bafe881 Gameplay`partial apply forwarder for reabstraction thunk helper from @callee_owned () -> (@unowned ()) to @callee_owned (@in ()) -> (@out ()) + 81
    frame #12: 0x000000010bafebb0 Gameplay`reabstraction thunk helper from @callee_owned (@in ()) -> (@out ()) to @callee_owned () -> (@unowned ()) + 32
    frame #13: 0x000000010bafebe7 Gameplay`reabstraction thunk helper from @callee_owned () -> (@unowned ()) to @callee_unowned @convention(block) () -> (@unowned ()) + 39
    frame #14: 0x00007fffa003724c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #15: 0x00007fffa0016b65 CoreFoundation`__CFRunLoopDoBlocks + 341
    frame #16: 0x00007fffa001632e CoreFoundation`__CFRunLoopRun + 910
    frame #17: 0x00007fffa0015d38 CoreFoundation`CFRunLoopRunSpecific + 296
    frame #18: 0x00007fff98922d55 HIToolbox`RunCurrentEventLoopInMode + 235
    frame #19: 0x00007fff98922a97 HIToolbox`ReceiveNextEventCommon + 184
    frame #20: 0x00007fff989229cf HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71
    frame #21: 0x00007fff92642236 AppKit`_DPSNextEvent + 1067
    frame #22: 0x00007fff92641665 AppKit`-[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
    frame #23: 0x00007fff926361c8 AppKit`-[NSApplication run] + 682
    frame #24: 0x000000010bafd9c8 Gameplay`main + 696
    frame #25: 0x00007fff932d75ad libdyld.dylib`start + 1
    frame #26: 0x00007fff932d75ad libdyld.dylib`start + 1


Version:
Xcode 7.1 beta (7B60)

Notes:
When width>1 or height>1, the crash does not occur.


Configuration:
OS X 10.11 (15A279b)

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!