[swift-corelibs-dev] dispatch_data_create() crashes with EXC_BAD_INSTRUCTION

Daniel Eggert danieleggert at me.com
Fri Apr 1 17:27:27 CDT 2016


This code crashes for me with SwiftFoundation, but not with Darwin Foundation:

/// Turn `NSData` into `dispatch_data_t`
internal func createDispatchData(data: NSData) -> dispatch_data_t {
    let c = data.copy() as! NSData
    let info = Unmanaged<NSData>.passRetained(c)
    let destructor = {
        info.release()
    }
    let q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)!
    return dispatch_data_create(c.bytes, c.length, q, destructor)
}



I'm not sure what to look for. The values being passed into dispatch_data_create() look sane.

Is this a red herring?



/Daniel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160402/6932cc7f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-04-01 at 20.42.04.png
Type: image/png
Size: 12187 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160402/6932cc7f/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-04-01 at 20.43.46.png
Type: image/png
Size: 18447 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160402/6932cc7f/attachment-0001.png>


More information about the swift-corelibs-dev mailing list