Codebase list mirage / 3d5b28a
Use the thumbpane_update_lock lock as a context manager Previously, if the thumbnail generation code failed, the lock would not be released. Thomas Ross 3 years ago
2 changed file(s) with 31 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
0 v0.10.1 - ???
1 BUG FIXES
2 + Fix a bug where an error in thumbnail generation could result in
3 thumbnail generation not working for the rest of the application
4 lifetime.
5
06 v0.10.0 - June 03, 2020
17 BREAKING CHANGES
28 + Drop support for Python 2.
775775 with self.thumbpane_stop_updating_lock:
776776 self.thumbpane_stop_updating[thread_id] = False
777777
778 if not self.thumbpane_update_lock.acquire():
779 return
780
781 self.thumbpane_create_dir()
782 # Check to see if any images need their thumbnails generated.
783 curr_coord = 0
784 imgnum = 0
785
786 for imgnum in range(start, end + 1):
787 if (
788 self.thumbpane_stop_updating.get(thread_id)
789 or self.closing_app
790 or self.stop_now
791 or not self.thumbpane_show
792 ):
793 break
794
795 if imgnum >= len(self.image_list):
796 break
797
798 self.thumbpane_set_image(self.image_list[imgnum], imgnum)
799
800 if select_image == imgnum and select_image == self.curr_img_in_list:
801 GLib.idle_add(self.thumbpane_select, select_image)
802
803 with self.thumbpane_stop_updating_lock:
804 del self.thumbpane_stop_updating[thread_id]
805
806 self.thumbpane_update_lock.release()
778 with self.thumbpane_update_lock:
779 self.thumbpane_create_dir()
780 # Check to see if any images need their thumbnails generated.
781 curr_coord = 0
782 imgnum = 0
783
784 for imgnum in range(start, end + 1):
785 if (
786 self.thumbpane_stop_updating.get(thread_id)
787 or self.closing_app
788 or self.stop_now
789 or not self.thumbpane_show
790 ):
791 break
792
793 if imgnum >= len(self.image_list):
794 break
795
796 self.thumbpane_set_image(self.image_list[imgnum], imgnum)
797
798 if select_image == imgnum and select_image == self.curr_img_in_list:
799 GLib.idle_add(self.thumbpane_select, select_image)
800
801 with self.thumbpane_stop_updating_lock:
802 del self.thumbpane_stop_updating[thread_id]
807803
808804 def thumbpane_clear_list(self):
809805 self.thumbpane_bottom_coord_loaded = 0