Skip to content

Commit

Permalink
Fix crash on exit from MIDI connections (#4340)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong authored and Wallacoloo committed May 8, 2018
1 parent af61a82 commit 03aa5fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/MidiPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class MidiPort : public Model, public SerializingObject
return m_writablePorts;
}

void invalidateCilent();

MidiPortMenu* m_readablePortsMenu;
MidiPortMenu* m_writablePortsMenu;

Expand Down
4 changes: 4 additions & 0 deletions src/core/midi/MidiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ MidiClient::MidiClient()
MidiClient::~MidiClient()
{
//TODO: noteOffAll(); / clear all ports
for (MidiPort* port : m_midiPorts)
{
port->invalidateCilent();
}
}


Expand Down
8 changes: 7 additions & 1 deletion src/core/midi/MidiPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@

#include "MidiPort.h"
#include "MidiClient.h"
#include "MidiDummy.h"
#include "Note.h"
#include "Song.h"

static MidiDummy s_dummyClient;



MidiPort::MidiPort( const QString& name,
Expand Down Expand Up @@ -410,4 +413,7 @@ void MidiPort::updateOutputProgram()




void MidiPort::invalidateCilent()
{
m_midiClient = &s_dummyClient;
}

0 comments on commit 03aa5fb

Please sign in to comment.