mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-12-24 00:28:34 -07:00
load_cell_probe: Fix memory leak on some probe failures
In the case where the homing module's `probing_move` raises an exception, the collector's `_finish_collecting` is never called. Normally the caller of `LoadCellProbingMove`'s `probing_move` uses the collector object by calling `collect_until`, which calls `_finish_collecting` when it is done, but if an exception is raised before that can be done the collector object keeps receiving samples and never does anything with them. This ensures that the collector is stopped if an exception is raised, so that samples do not accumulate indefinitely. Signed-off-by: Russell Cloran <rcloran@gmail.com>
This commit is contained in:
parent
5eb07966b5
commit
e18091bac3
1 changed files with 5 additions and 1 deletions
|
|
@ -482,7 +482,11 @@ class LoadCellProbingMove:
|
|||
# start collector after tare samples are consumed
|
||||
collector = self._start_collector()
|
||||
# do homing move
|
||||
return phoming.probing_move(self, pos, speed), collector
|
||||
try:
|
||||
return phoming.probing_move(self, pos, speed), collector
|
||||
except:
|
||||
collector.stop_collecting()
|
||||
raise
|
||||
|
||||
# Wait for the MCU to trigger with no movement
|
||||
def probing_test(self, gcmd, timeout):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue