From d594dcf24710e9aa787928e630f7dcc53bc9497b Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Tue, 2 Mar 2010 11:13:30 +0000 Subject: [PATCH] 03651: Deleting more than one person causes crash Actually these are fixes trying to fix this bug svn: r14575 --- src/gui/views/treemodels/flatbasemodel.py | 7 +++++++ src/gui/views/treemodels/treebasemodel.py | 9 ++++++++- src/plugins/lib/libpersonview.py | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui/views/treemodels/flatbasemodel.py b/src/gui/views/treemodels/flatbasemodel.py index 1b9cd3afd..abbbde037 100644 --- a/src/gui/views/treemodels/flatbasemodel.py +++ b/src/gui/views/treemodels/flatbasemodel.py @@ -627,6 +627,13 @@ class FlatBaseModel(gtk.GenericTreeModel): node = self.get_iter(path) self.row_changed(path, node) + def handle2path(self, handle): + """ + Obtain from a handle, a path. + Part of common api with flat/treebasemodel + """ + return self.on_get_path(handle) + def on_get_flags(self): """ Returns the GtkTreeModelFlags for this particular type of model diff --git a/src/gui/views/treemodels/treebasemodel.py b/src/gui/views/treemodels/treebasemodel.py index 6060645b6..0c50c547f 100644 --- a/src/gui/views/treemodels/treebasemodel.py +++ b/src/gui/views/treemodels/treebasemodel.py @@ -228,7 +228,7 @@ class TreeBaseModel(gtk.GenericTreeModel): the hierarchy. Each entry is a node object. handle2node A dictionary of gramps handles. Each entry is a node object. nodemap A NodeMap, mapping id's of the nodes to the node objects. Node - refer to other notes via id's in a linked list form. + refer to other nodes via id's in a linked list form. The model obtains data from database as needed and holds a cache of most recently used data. @@ -725,6 +725,13 @@ class TreeBaseModel(gtk.GenericTreeModel): """ return self.handle2node.get(handle) + def handle2path(self, handle): + """ + Obtain from a handle, a path. + Part of common api with flat/treebasemodel + """ + return self.on_get_path(self.get_node(handle)) + # The following implement the public interface of gtk.GenericTreeModel def on_get_flags(self): diff --git a/src/plugins/lib/libpersonview.py b/src/plugins/lib/libpersonview.py index 32d8ad54e..7688b4fe3 100644 --- a/src/plugins/lib/libpersonview.py +++ b/src/plugins/lib/libpersonview.py @@ -290,6 +290,8 @@ class BasePersonView(ListView): active_name = _("Delete Person (%s)") % name_displayer.display(person) # delete the person from the database + # Above will emit person-delete, which removes the person via + # callback to the model, so row delete is signaled self.dbstate.db.delete_person_from_database(person, trans) # commit the transaction @@ -298,7 +300,7 @@ class BasePersonView(ListView): # select the previously active person, turn off the busy cursor history = self.uistate.get_history(self.navigation_type(), self.navigation_group()) - history.back() + history.remove(person.handle) self.uistate.set_busy_cursor(False) def dummy_report(self, obj):