dnadoba / MIDIKit

MIDI message decoder/encoder and typesafe wrapper around CoreMIDI in Swift
Apache License 2.0
14 stars 4 forks source link

SIGABRT on packetList.deallocate() #1

Closed MicheleLonghi closed 4 years ago

MicheleLonghi commented 4 years ago

Hi trying to test your Library because is so well written and clean.

MIDI receive all perfect. On sending messages (any) I have SIGABRT on

extension MIDIOutputPort {
    public func send(_ messages: [MIDIMessage], to destination: MIDIEndpoint, timeStamp: MIDITimeStamp = 0) throws {
        let packetList = messages.allocatePackageList(timeStamp: timeStamp)
        **defer { packetList.deallocate() }**
        try send(packetList, to: destination)
    }
}

Any hint?

dnadoba commented 4 years ago

Hey,

I'm looking into it. I have created a test case which reproduces the issue. It looks like I need to use MIDIPacketListInit(_:) and MIDIPacketListAdd(_:_:_:_:_:_:) to build up a MIDIPacketList struct and not just allocated memory for it.

You can follow my progress on this branch: https://github.com/dnadoba/MIDIKit/tree/fix-allocatePackageList

dnadoba commented 4 years ago

Looks like I have fixed the issue. Could you please update to the release v1.1.0 and test it again? Thanks

MicheleLonghi commented 4 years ago

Yep, it's fixed!

Great library: the one Apple should have done from the beginning of the Swift era.

With multiple RTP connections (different ports) and maybe JavaScript support, it'd be the reference library for MIDI. Surely I'll work on it (forking now). Cheers.