From 028dab3a99d749159ee9cb94796d6e010a64fdcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gl=C3=B6ckner?= Date: Fri, 27 May 2016 09:37:10 +0200 Subject: Cannot refactor further: ownership problem! --- src/instrumentparser.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc index b42accd..af876a8 100644 --- a/src/instrumentparser.cc +++ b/src/instrumentparser.cc @@ -144,7 +144,13 @@ void InstrumentParser::startTag(const std::string& name, const attr_t& attr) auto audio_file = std::make_unique(path + "/" + attr.at("file"), filechannel); - // TODO: This is not deleted anywhere... + // note: memory leak! the channels are never released + // once I replaced this using unique_ptr, the channels were + // destroyed when the InstrumentParser went out of scope + // (see drumkitparser.cc, where the InstrumentParser lives in + // local scope). + // so.. we cannot replace this using smart ptr until we decided + // the ownership semantics for instances InstrumentChannel InstrumentChannel *instrument_channel = new InstrumentChannel(attr.at("channel")); -- cgit v1.2.3