1189 |
} |
} |
1190 |
|
|
1191 |
void File::DeleteInstrument(Instrument* pInstrument) { |
void File::DeleteInstrument(Instrument* pInstrument) { |
1192 |
|
if (!pInstrument) return; |
1193 |
|
|
1194 |
for (int i = 0; i < GetPresetCount(); i++) { |
for (int i = 0; i < GetPresetCount(); i++) { |
1195 |
Preset* p = GetPreset(i); |
Preset* p = GetPreset(i); |
1196 |
if (p == NULL) continue; |
if (p == NULL) continue; |
1205 |
if (GetInstrument(i) == pInstrument) { |
if (GetInstrument(i) == pInstrument) { |
1206 |
Instruments[i] = NULL; |
Instruments[i] = NULL; |
1207 |
delete pInstrument; |
delete pInstrument; |
1208 |
|
// an instrument instance only exists once in the list, so stop |
1209 |
|
// here (which also silences a clang sanatizer warning about |
1210 |
|
// potential multiple memory releases of pInstrument above) |
1211 |
|
return; |
1212 |
} |
} |
1213 |
} |
} |
1214 |
} |
} |