From c9d7b00c0c4484ea54d6a97995ecb9f58af6c1e5 Mon Sep 17 00:00:00 2001 From: kulath Date: Thu, 18 Jun 2015 22:54:45 +0100 Subject: [PATCH] 0008537: Gedcom import crashes. Fix problem when matching places with the same name which are enclosed by different places. --- gramps/plugins/lib/libgedcom.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gramps/plugins/lib/libgedcom.py b/gramps/plugins/lib/libgedcom.py index b644352df..17412a189 100644 --- a/gramps/plugins/lib/libgedcom.py +++ b/gramps/plugins/lib/libgedcom.py @@ -2910,7 +2910,7 @@ class GedcomParser(UpdateCallback): return True return False - def __find_place(self, title, location): + def __find_place(self, title, location, placeref_list): """ Finds an existing place based on the title and primary location. @@ -2924,11 +2924,13 @@ class GedcomParser(UpdateCallback): place = self.dbase.get_place_from_handle(place_handle) if place.get_title() == title: if self.__loc_is_empty(location) and \ - self.__loc_is_empty(self.__get_first_loc(place)): + self.__loc_is_empty(self.__get_first_loc(place)) and \ + place.get_placeref_list() == placeref_list: return place elif (not self.__loc_is_empty(location) and \ not self.__loc_is_empty(self.__get_first_loc(place)) and - self.__get_first_loc(place).is_equivalent(location) == IDENTICAL): + self.__get_first_loc(place).is_equivalent(location) == IDENTICAL) and \ + place.get_placeref_list() == placeref_list: return place return None @@ -2946,7 +2948,8 @@ class GedcomParser(UpdateCallback): if sub_state.place: # see whether this place already exists place = self.__find_place(sub_state.place.get_title(), - self.__get_first_loc(sub_state.place)) + self.__get_first_loc(sub_state.place), + sub_state.place.get_placeref_list()) if place is None: place = sub_state.place self.dbase.add_place(place, self.trans) @@ -4534,7 +4537,7 @@ class GedcomParser(UpdateCallback): """ try: title = line.data - place = self.__find_place(title, None) + place = self.__find_place(title, None, None) if place is None: place = Place() place.set_title(title) @@ -5521,7 +5524,8 @@ class GedcomParser(UpdateCallback): if self.addr_is_detail and state.place: # Commit the enclosing place - place = self.__find_place(state.place.get_title(), None) + place = self.__find_place(state.place.get_title(), None, + state.place.get_placeref_list()) if place is None: place = state.place self.dbase.add_place(place, self.trans)