| 496 | } |
| 497 | |
| 498 | void Snapshots::PostRepatch(PatchCableSource* cableSource, bool fromUserClick) |
| 499 | { |
| 500 | if (TheSynth->IsLoadingState()) |
| 501 | return; |
| 502 | |
| 503 | auto numModules = mSnapshotModules.size(); |
| 504 | auto numControls = mSnapshotControls.size(); |
| 505 | |
| 506 | mSnapshotModules.clear(); |
| 507 | for (auto cable : mModuleCable->GetPatchCables()) |
| 508 | mSnapshotModules.push_back(static_cast<IDrawableModule*>(cable->GetTarget())); |
| 509 | mSnapshotControls.clear(); |
| 510 | for (auto cable : mUIControlCable->GetPatchCables()) |
| 511 | mSnapshotControls.push_back(static_cast<IUIControl*>(cable->GetTarget())); |
| 512 | |
| 513 | if (mSnapshotModules.size() < numModules || mSnapshotControls.size() < numControls) //we removed something, clean up any snapshots that refer to it |
| 514 | { |
| 515 | for (auto& square : mSnapshotCollection) |
| 516 | { |
| 517 | std::vector<Snapshot> toRemove; |
| 518 | for (const auto& snapshot : square.mSnapshots) |
| 519 | { |
| 520 | if (!IsConnectedToPath(snapshot.mControlPath)) |
| 521 | toRemove.push_back(snapshot); |
| 522 | } |
| 523 | |
| 524 | for (auto remove : toRemove) |
| 525 | square.mSnapshots.remove(remove); |
| 526 | } |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | bool Snapshots::IsConnectedToPath(std::string path) const |
| 531 | { |
nothing calls this directly
no test coverage detected