See #2978. Fix crash upon drawing deletion.

This commit is contained in:
Dion Moult
2023-04-14 09:36:51 +10:00
parent 03d9efb790
commit 459c4d7fcc
2 changed files with 6 additions and 7 deletions
+6 -6
View File
@@ -261,11 +261,6 @@ def remove_drawing(ifc, drawing_tool, drawing=None):
if collection:
drawing_tool.delete_collection(collection)
group = drawing_tool.get_drawing_group(drawing)
if group:
drawing_tool.delete_drawing_elements(drawing_tool.get_group_elements(group))
ifc.run("group.remove_group", group=group)
for reference in drawing_tool.get_drawing_references(drawing):
reference_obj = ifc.get_object(reference)
if reference_obj:
@@ -277,7 +272,12 @@ def remove_drawing(ifc, drawing_tool, drawing=None):
if drawing_tool.does_file_exist(uri):
drawing_tool.delete_file(uri)
ifc.run("document.remove_information", information=information)
ifc.run("root.remove_product", product=drawing)
group = drawing_tool.get_drawing_group(drawing)
if group:
drawing_tool.delete_drawing_elements(drawing_tool.get_group_elements(group))
ifc.run("group.remove_group", group=group)
drawing_tool.import_drawings()
-1
View File
@@ -356,7 +356,6 @@ class TestRemoveDrawing:
drawing.does_file_exist("absolute_uri").should_be_called().will_return(True)
drawing.delete_file("absolute_uri").should_be_called()
ifc.run("document.remove_information", information="information").should_be_called()
ifc.run("root.remove_product", product="drawing").should_be_called()
drawing.import_drawings().should_be_called()
subject.remove_drawing(ifc, drawing, drawing="drawing")