From 8182d434ec50ca1f71b560ef4621448a6cbf2dae Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Fri, 5 Jun 2026 09:55:15 +0200 Subject: [PATCH] GeoTIFF: Fix crashes at 'cannot remove artist'. --- src/View/GeoTIFF/Window.py | 7 +++++-- src/View/Results/PlotXY.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/View/GeoTIFF/Window.py b/src/View/GeoTIFF/Window.py index d428ea30..d57de56f 100644 --- a/src/View/GeoTIFF/Window.py +++ b/src/View/GeoTIFF/Window.py @@ -16,7 +16,7 @@ # -*- coding: utf-8 -*- -from tools import trace, timer +from tools import trace, timer, logger_exception from PyQt5.QtWidgets import ( QAction, QListView, QVBoxLayout, @@ -134,7 +134,10 @@ class GeoTIFFListWindow(PamhyrWindow): def _update_rectangle(self): for rect in self._plot_rect: - rect.remove() + try: + rect.remove() + except Exception as e: + logger_exception(e) self._plot_rect = [] diff --git a/src/View/Results/PlotXY.py b/src/View/Results/PlotXY.py index b4618079..91cad26c 100644 --- a/src/View/Results/PlotXY.py +++ b/src/View/Results/PlotXY.py @@ -20,7 +20,7 @@ import logging from functools import reduce -from tools import timer, trace +from tools import timer, trace, logger_exception from View.Tools.PamhyrPlot import PamhyrPlot import numpy as np from matplotlib import collections @@ -332,7 +332,10 @@ class PlotXY(PamhyrPlot): lst = self._data[0]._study.river._geotiff.lst 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 = {}