Skip to content

Commit

Permalink
fix: qgis crash when trying to remove multiple elements from list
Browse files Browse the repository at this point in the history
  • Loading branch information
merydian committed Mar 26, 2024
1 parent db0dcad commit ce3ea15
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ORStools/gui/ORStoolsDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,12 @@ def _on_clear_listwidget_click(self):
"""Clears the contents of the QgsListWidget and the annotations."""
items = self.routing_fromline_list.selectedItems()
if items:
rows = [self.routing_fromline_list.row(item) for item in items]
# if items are selected, only clear those
for item in items:
row = self.routing_fromline_list.row(item)
self.routing_fromline_list.takeItem(row)
for row in sorted(rows, reverse=True):
if self.annotations:
self.project.annotationManager().removeAnnotation(self.annotations.pop(row))
self.routing_fromline_list.takeItem(row)
else:
# else clear all items and annotations
self.routing_fromline_list.clear()
Expand Down

0 comments on commit ce3ea15

Please sign in to comment.