fix crash at session close/exit if a midi-control-surface is used
[ardour.git] / libs / ardour / session_midi.cc
index 93df1fc9466e16ed98c348c4d5f1da4855fee560..47c7bd4c4037d60aa327366bd84057adbd86e667 100644 (file)
@@ -417,7 +417,7 @@ Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes)
        msg[4] = 0x1;
        msg[9] = 0xf7;
 
-       msg[5] = mtc_timecode_bits | timecode.hours;
+       msg[5] = mtc_timecode_bits | (timecode.hours % 24);
        msg[6] = timecode.minutes;
        msg[7] = timecode.seconds;
        msg[8] = timecode.frames;
@@ -597,6 +597,7 @@ Session::send_song_position_pointer (framepos_t)
 int
 Session::start_midi_thread ()
 {
+       if (midi_control_ui) { return 0; }
        midi_control_ui = new MidiControlUI (*this);
        midi_control_ui->run ();
        return 0;