spine-tools / Spine-Toolbox

Spine Toolbox is an open source Python package to manage data, scenarios and workflows for modelling and simulation. You can have your local workflow, but work as a team through version control and SQL databases.
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
73 stars 18 forks source link

Traceback from Scenario model #2989

Closed soininen closed 3 weeks ago

soininen commented 1 month ago

Closing, then reopening Database editor and making modifications to scenarios causes this Traceback:

Traceback (most recent call last):
  File "C:\Users\ajsanttij\Sources\Spine-Toolbox\spinetoolbox\helpers.py", line 138, in new_function
    return func(*args, **kwargs)
  File "C:\Users\ajsanttij\Sources\Spine-Toolbox\spinetoolbox\fetch_parent.py", line 99, in _apply_pending_changes
    last_handler({db_map: items})
  File "C:\Users\ajsanttij\Sources\Spine-Toolbox\spinetoolbox\fetch_parent.py", line 320, in handle_items_added
    self._handle_items_added(db_map_data)
  File "C:\Users\ajsanttij\Sources\Spine-Toolbox\spinetoolbox\spine_db_editor\mvcmodels\tree_item_utility.py", line 198, in handle_items_added
    self.insert_children(len(self.non_empty_children), children_uncommitted)
  File "C:\Users\ajsanttij\Sources\Spine-Toolbox\spinetoolbox\mvcmodels\minimal_tree_model.py", line 153, in insert_children
    parent_index = self.index()
  File "C:\Users\ajsanttij\Sources\Spine-Toolbox\spinetoolbox\mvcmodels\minimal_tree_model.py", line 124, in index
    return self.model.index_from_item(self)
  File "C:\Users\ajsanttij\Sources\Spine-Toolbox\spinetoolbox\mvcmodels\minimal_tree_model.py", line 317, in index_from_item
    return self.createIndex(row, 0, item)
RuntimeError: Internal C++ object (ScenarioModel) already deleted.

Looks like we do not clean up Fetchers properly.

soininen commented 3 weeks ago

Duplicate of #2742