Skip to content

Commit

Permalink
Use the free-message for multi-delete actions also (#1465)
Browse files Browse the repository at this point in the history
CLoses #712
  • Loading branch information
baconpaul authored Nov 25, 2024
1 parent 6be5825 commit 65e75c3
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/messaging/client/structure_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,17 @@ inline void removeSelectedZones(const bool &, engine::Engine &engine, MessageCon
e.getPatch()->getPart(s.part)->getGroup(s.group)->getZone(s.zone)->id});
}
for (auto [p, g, zid] : ids)
e.getPatch()->getPart(p)->getGroup(g)->removeZone(zid);
{
auto z = e.getPatch()->getPart(p)->getGroup(g)->removeZone(zid);
auto zoneToFree = z.release();

messaging::audio::AudioToSerialization a2s;
a2s.id = audio::a2s_delete_this_pointer;
a2s.payloadType = audio::AudioToSerialization::TO_BE_DELETED;
a2s.payload.delThis.ptr = zoneToFree;
a2s.payload.delThis.type = audio::AudioToSerialization::ToBeDeleted::engine_Zone;
e.getMessageController()->sendAudioToSerialization(a2s);
}
},
[t = part](auto &engine) {
engine.getSampleManager()->purgeUnreferencedSamples();
Expand Down Expand Up @@ -263,6 +273,15 @@ inline void clearPart(const int p, engine::Engine &engine, MessageController &co
e.terminateVoicesForGroup(*groupO);
auto gid = groupO->id;
auto g = part->removeGroup(gid);

auto groupToFree = g.release();

messaging::audio::AudioToSerialization a2s;
a2s.id = audio::a2s_delete_this_pointer;
a2s.payloadType = audio::AudioToSerialization::TO_BE_DELETED;
a2s.payload.delThis.ptr = groupToFree;
a2s.payload.delThis.type = audio::AudioToSerialization::ToBeDeleted::engine_Group;
e.getMessageController()->sendAudioToSerialization(a2s);
}
},
[pt = p](auto &engine) {
Expand Down

0 comments on commit 65e75c3

Please sign in to comment.