Appliance: drop cables when taking down appliance#60621
Merged
Fris0uman merged 2 commits intoCleverRaven:masterfrom Sep 1, 2022
Merged
Appliance: drop cables when taking down appliance#60621Fris0uman merged 2 commits intoCleverRaven:masterfrom
Fris0uman merged 2 commits intoCleverRaven:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
Describe the solution
When taking down an appliance, call
vehicle::shed_loose_partsto handle dropping any power connections. Any items used to connect two or more appliances and/or vehicles will be dropped at the appliances position.Describe alternatives you've considered
N/A
Testing
Taking down a standing lamp connected in various ways to other appliances and a vehicle:
2022-08-31.01-03-24.mp4
Additional context
While testing this originally, I ran into a bug where an appliance had a fake part while being taken down. So instead of calling
map::destroy_vehicle, the parts list gets accessed after the real part is removed, causing this use-after-free output from ASAN:(snip)
The fix I used was to skip fake parts when checking the remaining part count (2604d39)