Author: tlinnet Date: Wed Jan 14 17:08:30 2015 New Revision: 27173 URL: http://svn.gna.org/viewcvs/relax?rev=27173&view=rev Log: Merged revisions 27167 via svnmerge from svn+ssh://tlinnet@xxxxxxxxxxx/svn/relax/trunk ........ r27167 | bugman | 2015-01-14 17:00:51 +0100 (Wed, 14 Jan 2015) | 10 lines Fix for bug #23187 (https://gna.org/bugs/?23187). This is the problem whereby opening the spin viewer window, deleting a residue, and then reopening the spin viewer crashes relax. This change completes the spin viewer update_*() functions. The prune_list variable was initialised but not used. Now it is used to store the keys of the items to delete, and then the items are deleted at the end in a new loop so that the loop over the dictionary keys is not corrupted. ........ Modified: branches/nmrglue/ (props changed) branches/nmrglue/gui/spin_viewer/tree.py Propchange: branches/nmrglue/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Jan 14 17:08:30 2015 @@ -1 +1 @@ -/trunk:1-27165 +/trunk:1-27172 Modified: branches/nmrglue/gui/spin_viewer/tree.py URL: http://svn.gna.org/viewcvs/relax/branches/nmrglue/gui/spin_viewer/tree.py?rev=27173&r1=27172&r2=27173&view=diff ============================================================================== --- branches/nmrglue/gui/spin_viewer/tree.py (original) +++ branches/nmrglue/gui/spin_viewer/tree.py Wed Jan 14 17:08:30 2015 @@ -740,10 +740,14 @@ # Get the python data. info = self.tree.GetItemPyData(key) - # Prune if it has been removed. + # Add to the prune list if it has been removed. if info['id'] not in mol_ids: - self.tree.Delete(key) - self.tree_ids.pop(key) + prune_list.append(key) + + # Delete the data. + for key in prune_list: + self.tree.Delete(key) + self.tree_ids.pop(key) def prune_res(self, mol_branch_id, mol_id): @@ -764,10 +768,14 @@ # Get the residue. res = return_residue(info['id']) - # Prune if it has been removed or renamed/renumbered. + # Add to the prune list if it has been removed or renamed/renumbered. if res == None or res.name != info['res_name'] or res.num != info['res_num']: - self.tree.Delete(key) - self.tree_ids[mol_branch_id].pop(key) + prune_list.append(key) + + # Delete the data. + for key in prune_list: + self.tree.Delete(key) + self.tree_ids[mol_branch_id].pop(key) def prune_spin(self, mol_branch_id, res_branch_id, res_id): @@ -790,10 +798,14 @@ # Get the spin. spin = return_spin(info['id']) - # Prune if it has been removed or renamed/renumbered. + # Add to the prune list if it has been removed or renamed/renumbered. if spin == None or spin.name != info['spin_name'] or spin.num != info['spin_num']: - self.tree.Delete(key) - self.tree_ids[mol_branch_id][res_branch_id].pop(key) + prune_list.append(key) + + # Delete the data. + for key in prune_list: + self.tree.Delete(key) + self.tree_ids[mol_branch_id][res_branch_id].pop(key) def set_bitmap_mol(self, mol_branch_id, select=True):