CAM: Fix ReferenceError when accessing deleted toolbit object
Prevent crash (CAMTests) in ToolBitRecomputeObserver when the toolbit object has been deleted/missing by catching ReferenceError before accessing its Document attribute. This ensures slotRecomputedDocument exits gracefully if the object is no longer valid. src/Mod/CAM/Path/Tool/toolbit/models/base.py - Wrapped access to self.toolbit_proxy.obj.Document in try/except to handle ReferenceError if object is deleted/missing, preventing crash during document recompute.
This commit is contained in:
committed by
Chris Hennes
parent
5556821e7e
commit
ec2a41b86b
@@ -52,8 +52,15 @@ class ToolBitRecomputeObserver:
|
||||
|
||||
def slotRecomputedDocument(self, doc):
|
||||
"""Called when document recompute is finished."""
|
||||
# Check if the toolbit object is still valid
|
||||
try:
|
||||
obj_doc = self.toolbit_proxy.obj.Document
|
||||
except ReferenceError:
|
||||
# Object has been deleted or does not exist, nothing to do
|
||||
return
|
||||
|
||||
# Only process updates for the correct document
|
||||
if doc != self.toolbit_proxy.obj.Document:
|
||||
if doc != obj_doc:
|
||||
return
|
||||
|
||||
# Process any queued visual updates
|
||||
|
||||
Reference in New Issue
Block a user