Spine-Toolbox icon indicating copy to clipboard operation
Spine-Toolbox copied to clipboard

Traceback when undoing with hidden entity classes

Open PiispaH opened this issue 7 months ago • 0 comments

  1. In a fresh db enable "Hide empty classes".
  2. Add entity class "A".
  3. Add an entity to class "A" by filling out the empty row in Entity alternative table. (bug in #2828 happens)
  4. Select "Fully expand" from the root item. (A should become visible again)
  5. Undo three times.
Traceback (most recent call last):
  File "C:\spine-toolbox\spinetoolbox\helpers.py", line 136, in new_function
    return func(*args, **kwargs)
  File "C:\spine-toolbox\spinetoolbox\fetch_parent.py", line 99, in _apply_pending_changes
    last_handler({db_map: items})
  File "C:\spine-toolbox\spinetoolbox\fetch_parent.py", line 327, in handle_items_removed
    self._handle_items_removed(db_map_data)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 328, in handle_items_removed
    self.remove_children_by_id(db_map_ids)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 356, in remove_children_by_id
    self.deep_refresh_children()
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 162, in deep_refresh_children
    self.remove_children(row, count)
  File "C:\spine-toolbox\spinetoolbox\spine_db_editor\mvcmodels\multi_db_tree_item.py", line 439, in remove_children
    if super().remove_children(position, count):
  File "C:\spine-toolbox\spinetoolbox\mvcmodels\minimal_tree_model.py", line 193, in remove_children
    self.model.beginRemoveRows(self.index(), first, last)
  File "C:\spine-toolbox\spinetoolbox\mvcmodels\minimal_tree_model.py", line 337, in parent
    return self.createIndex(parent_item.child_number(), 0, parent_item)
TypeError: 'PySide6.QtCore.QAbstractItemModel.createIndex' called with wrong argument types:
  PySide6.QtCore.QAbstractItemModel.createIndex(NoneType, int, EntityClassItem)
Supported signatures:
  PySide6.QtCore.QAbstractItemModel.createIndex(int, int, int = 0)
  PySide6.QtCore.QAbstractItemModel.createIndex(int, int, object)
python-BaseException

As a bonus bug 🎉, if the class A is expanded after the step 4, this beautiful sight unveils itself: image

PiispaH avatar Jul 11 '24 11:07 PiispaH