[ocrfeeder] Change the way the areas are removed to make it more secure



commit af3c4d7e85a2bc6491fb2293463896f27459e185
Author: Joaquim Rocha <jrocha igalia com>
Date:   Sat Nov 12 17:58:43 2011 +0100

    Change the way the areas are removed to make it more secure
    
    Since the removal of the areas acted on the list of selected areas
    directly, if that list was meanwhile changed, it could end up
    mistakenly removing areas. This could occur, for example, if some
    area was selected from the callback that is called when another area
    is removed.

 src/ocrfeeder/studio/customWidgets.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/ocrfeeder/studio/customWidgets.py b/src/ocrfeeder/studio/customWidgets.py
index 7f989f6..b137619 100644
--- a/src/ocrfeeder/studio/customWidgets.py
+++ b/src/ocrfeeder/studio/customWidgets.py
@@ -169,10 +169,13 @@ class SelectableBoxesArea(goocanvas.Canvas):
         self.__selectSurroundingArea(1)
 
     def deleteSelectedAreas(self):
+        areas_to_remove = []
         while self.selected_areas:
             selected_area = self.selected_areas.pop(0)
             selected_area.remove()
-            self.emit('removed_box', selected_area)
+            areas_to_remove.append(selected_area)
+        for area in areas_to_remove:
+            self.emit('removed_box', area)
 
     def __selectSurroundingArea(self, area_offset):
         areas = self.getAllAreas()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]