GeoTIFF: Fix crashes at 'cannot remove artist'.

scenarios
Pierre-Antoine 2026-06-05 09:55:15 +02:00
parent da78d0cdb1
commit 8182d434ec
2 changed files with 10 additions and 4 deletions

View File

@ -16,7 +16,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from tools import trace, timer from tools import trace, timer, logger_exception
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QAction, QListView, QVBoxLayout, QAction, QListView, QVBoxLayout,
@ -134,7 +134,10 @@ class GeoTIFFListWindow(PamhyrWindow):
def _update_rectangle(self): def _update_rectangle(self):
for rect in self._plot_rect: for rect in self._plot_rect:
rect.remove() try:
rect.remove()
except Exception as e:
logger_exception(e)
self._plot_rect = [] self._plot_rect = []

View File

@ -20,7 +20,7 @@ import logging
from functools import reduce from functools import reduce
from tools import timer, trace from tools import timer, trace, logger_exception
from View.Tools.PamhyrPlot import PamhyrPlot from View.Tools.PamhyrPlot import PamhyrPlot
import numpy as np import numpy as np
from matplotlib import collections from matplotlib import collections
@ -332,7 +332,10 @@ class PlotXY(PamhyrPlot):
lst = self._data[0]._study.river._geotiff.lst lst = self._data[0]._study.river._geotiff.lst
for img in self._plot_img: for img in self._plot_img:
self._plot_img[img].remove() try:
self._plot_img[img].remove()
except Exception as e:
logger_exception(e)
self._plot_img = {} self._plot_img = {}