From d6d3bbd5edfa87e534b904ce871d9dbc17cdb60e Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 29 Dec 2021 21:37:07 -0500 Subject: [PATCH] cwIoMidiRecordPlay.cpp : Timer is now deleted in _destroy(). --- cwIoMidiRecordPlay.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cwIoMidiRecordPlay.cpp b/cwIoMidiRecordPlay.cpp index a760e0c..e42436a 100644 --- a/cwIoMidiRecordPlay.cpp +++ b/cwIoMidiRecordPlay.cpp @@ -13,6 +13,7 @@ #include "cwIo.h" #include "cwIoMidiRecordPlay.h" +#define TIMER_LABEL "midi_record_play_timer" namespace cw { @@ -74,7 +75,11 @@ namespace cw rc_t _destroy( midi_record_play_t* p ) { rc_t rc = kOkRC; - + unsigned timerIdx; + + if((timerIdx = io::timerLabelToIndex( p->ioH, TIMER_LABEL )) != kInvalidIdx ) + io::timerDestroy( p->ioH, timerIdx); + mem::release(p->msgArray); mem::release(p->midiOutDevLabel); mem::release(p->midiOutPortLabel); @@ -583,7 +588,7 @@ cw::rc_t cw::midi_record_play::create( handle_t& hRef, io::handle_t ioH, const o } // create the MIDI playback timer - if((rc = timerCreate( p->ioH, "midi_record_play_timer", kMidiRecordPlayTimerId, p->midi_timer_period_micro_sec)) != kOkRC ) + if((rc = timerCreate( p->ioH, TIMER_LABEL, kMidiRecordPlayTimerId, p->midi_timer_period_micro_sec)) != kOkRC ) { cwLogError(rc,"Audio-MIDI timer create failed."); goto errLabel;