From b32b1d3749180a164cc95e9a4284dbb825c06b2a Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Wed, 24 Jan 2024 11:15:40 -0500 Subject: [PATCH] Attempt to fix the crash issue with Houdini --- python/shotgun_model/shotgun_query_model.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/python/shotgun_model/shotgun_query_model.py b/python/shotgun_model/shotgun_query_model.py index 3861eeb..4fd1535 100644 --- a/python/shotgun_model/shotgun_query_model.py +++ b/python/shotgun_model/shotgun_query_model.py @@ -880,11 +880,15 @@ def __do_depth_first_tree_deletion(self, node): # delete the child leaves for index in range(node.rowCount(), 0, -1): - # Use `takeRow` instead of `removeRow` to prevent model from deleting - # the data before we're done using it. takeRow does not free the memory - # but we own the objects and do not keep a reference to it, so garbage - # collection will take care of freeing up the memory for us. - node.takeRow(index - 1) + if sgtk.platform.current_engine().instance_name == "tk-houdini": + node.removeRow(index - 1) + else: + # For every other engine, + # Use `takeRow` instead of `removeRow` to prevent model from deleting + # the data before we're done using it. takeRow does not free the memory + # but we own the objects and do not keep a reference to it, so garbage + # collection will take care of freeing up the memory for us. + node.takeRow(index - 1) def __remove_unique_id_r(self, item): """