waddlesplash / QMidi

Qt library for MIDI output & MIDI file I/O.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unnecessary disposing

Trebor-Huang opened this issue · comments

if (fMidiPtrs->outputPort != 0) {
MIDIPortDispose(fMidiPtrs->outputPort);
fMidiPtrs->outputPort = 0;
}
if (fMidiPtrs->client != 0) {
MIDIClientDispose(fMidiPtrs->client);
fMidiPtrs->client = 0;
}

Quoting documentation:

Don’t explicitly dispose of your client; the system automatically disposes all clients when an app terminates. However, if you call this method to dispose the last or only client owned by an app, the MIDI server may exit if there are no other clients remaining in the system. If this occurs, all subsequent calls by your app to MIDIClientCreate and MIDIClientCreateWithBlock fail.

There is also a deprecated API in use. I'm a bit tight on time finishing schoolwork, but after a few days I may come back with a PR.