cwIoMidiRecordPlay.cpp : Change the location where p->ioH is initialized in create() to guarantee that it is valid in _destroy().

This commit is contained in:
kevin 2023-01-30 19:23:42 -05:00
parent cb192f32cb
commit 0d644c9281

View File

@ -1298,11 +1298,12 @@ cw::rc_t cw::midi_record_play::create( handle_t& hRef, io::handle_t ioH, const o
return rc; return rc;
p = mem::allocZ<midi_record_play_t>(); p = mem::allocZ<midi_record_play_t>();
p->ioH = ioH; // p->ioH is used in _destory() so initialize it here
if((rc = _parseCfg(p,cfg)) != kOkRC ) if((rc = _parseCfg(p,cfg)) != kOkRC )
goto errLabel; goto errLabel;
p->ioH = ioH;
p->cb = cb; p->cb = cb;
p->cb_arg = cb_arg; p->cb_arg = cb_arg;
p->halfPedalState = kHalfPedalDone; p->halfPedalState = kHalfPedalDone;