ccrma / chuck

ChucK Music Programming Language
http://chuck.stanford.edu/
GNU General Public License v2.0
799 stars 127 forks source link

Avoid crash from double-destroying LiSaX. #438

Closed eswartz closed 4 months ago

eswartz commented 4 months ago

I don't know why it's being destroyed twice and this doesn't try to fix that. Maybe it's intentional, since LiSaX derives from LiSa but shares the same constructor/destructor in type_engine_import_ugen_begin calls?

When I add EM_log( CK_LOG_CORE, "(lisa): destroying, d = %p", d); inside LiSaMulti_dtor, I see indeed that it's called twice, once with a valid pointer and once with null. A similar test with e.g. SinOsc or the single-channel LiSa only reports one call to the dtor.

Repro:

LiSa2 lisa; // or LiSa10, etc -- but not LiSa
// crashes
gewang commented 4 months ago

removed duplicate LiSaX constructors and destructors in bb2bd3c; this also removes a memory leak in LiSaX double construction; thank you @eswartz