1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-08 04:20:09 +00:00

Windows: Fixed a crash in MidiInput::openDevice()

This commit is contained in:
ed 2019-03-06 12:20:49 +00:00
parent 4bedc679b1
commit d39c33247e

View file

@ -1819,20 +1819,19 @@ MidiInput* MidiInput::openDevice (const String& deviceIdentifier, MidiInputCallb
if (deviceIdentifier.isEmpty() || callback == nullptr)
return nullptr;
MidiInput input ({}, {});
std::unique_ptr<MidiInput> in (new MidiInput ({}, deviceIdentifier));
std::unique_ptr<MidiServiceType::InputWrapper> wrapper;
try
{
wrapper.reset (MidiService::getService().createInputWrapper (input, deviceIdentifier, *callback));
wrapper.reset (MidiService::getService().createInputWrapper (*in, deviceIdentifier, *callback));
}
catch (std::runtime_error&)
{
return nullptr;
}
std::unique_ptr<MidiInput> in;
in.reset (new MidiInput (wrapper->getDeviceName(), deviceIdentifier));
in->setName (wrapper->getDeviceName());
in->internal = wrapper.release();
return in.release();