From e262a2d3bb709ebda15325b21635391d2eb34aea Mon Sep 17 00:00:00 2001 From: pax Date: Sat, 11 Apr 2026 19:28:13 -0500 Subject: [PATCH] grid: remove unused imports, stop animation before widget deletion Unused: Path, Post, QPainterPath, QMenu, QApplication. FlowLayout.clear() now stops any in-flight fade animation before calling deleteLater() on thumbnails. Without this, a mid-flight QPropertyAnimation can fire property updates on a widget that's queued for deletion. --- booru_viewer/gui/grid.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/booru_viewer/gui/grid.py b/booru_viewer/gui/grid.py index ca1481d..6726061 100644 --- a/booru_viewer/gui/grid.py +++ b/booru_viewer/gui/grid.py @@ -3,22 +3,17 @@ from __future__ import annotations import logging -from pathlib import Path log = logging.getLogger("booru") from PySide6.QtCore import Qt, Signal, QSize, QRect, QRectF, QMimeData, QUrl, QPoint, Property, QPropertyAnimation, QEasingCurve -from PySide6.QtGui import QPixmap, QPainter, QPainterPath, QColor, QPen, QKeyEvent, QWheelEvent, QDrag, QMouseEvent +from PySide6.QtGui import QPixmap, QPainter, QColor, QPen, QKeyEvent, QWheelEvent, QDrag, QMouseEvent from PySide6.QtWidgets import ( QWidget, QScrollArea, - QMenu, - QApplication, QRubberBand, ) -from ..core.api.base import Post - THUMB_SIZE = 180 THUMB_SPACING = 2 BORDER_WIDTH = 2 @@ -382,6 +377,8 @@ class FlowLayout(QWidget): def clear(self) -> None: for w in self._items: + if hasattr(w, '_fade_anim') and w._fade_anim is not None: + w._fade_anim.stop() w.setParent(None) # type: ignore w.deleteLater() self._items.clear()