03651: Deleting more than one person causes crash

Actually these are fixes trying to fix this bug


svn: r14574
This commit is contained in:
Benny Malengier 2010-03-02 11:13:19 +00:00
parent 3dcc74a173
commit 0a2d52a5a0
3 changed files with 18 additions and 2 deletions

View File

@ -627,6 +627,13 @@ class FlatBaseModel(gtk.GenericTreeModel):
node = self.get_iter(path) node = self.get_iter(path)
self.row_changed(path, node) 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): def on_get_flags(self):
""" """
Returns the GtkTreeModelFlags for this particular type of model Returns the GtkTreeModelFlags for this particular type of model

View File

@ -228,7 +228,7 @@ class TreeBaseModel(gtk.GenericTreeModel):
the hierarchy. Each entry is a node object. the hierarchy. Each entry is a node object.
handle2node A dictionary of gramps handles. 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 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 The model obtains data from database as needed and holds a cache of most
recently used data. recently used data.
@ -725,6 +725,13 @@ class TreeBaseModel(gtk.GenericTreeModel):
""" """
return self.handle2node.get(handle) 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 # The following implement the public interface of gtk.GenericTreeModel
def on_get_flags(self): def on_get_flags(self):

View File

@ -290,6 +290,8 @@ class BasePersonView(ListView):
active_name = _("Delete Person (%s)") % name_displayer.display(person) active_name = _("Delete Person (%s)") % name_displayer.display(person)
# delete the person from the database # 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) self.dbstate.db.delete_person_from_database(person, trans)
# commit the transaction # commit the transaction
@ -298,7 +300,7 @@ class BasePersonView(ListView):
# select the previously active person, turn off the busy cursor # select the previously active person, turn off the busy cursor
history = self.uistate.get_history(self.navigation_type(), history = self.uistate.get_history(self.navigation_type(),
self.navigation_group()) self.navigation_group())
history.back() history.remove(person.handle)
self.uistate.set_busy_cursor(False) self.uistate.set_busy_cursor(False)
def dummy_report(self, obj): def dummy_report(self, obj):