Skip to content

Commit c94250c

Browse files
committed
Fix possible recursion error with queued draw commands
1 parent deef085 commit c94250c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mousetracks2/gui/main_window.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,9 +2331,10 @@ def draw_pixmap_line(self, old_position: tuple[int, int] | None, new_position: t
23312331
self.ui.thumbnail.update_pixels(*(Pixel(QtCore.QPoint(x, y), self.pixel_colour) for x, y in unique_pixels))
23322332

23332333
# Redraw any queued coordinates after profile switch
2334-
while not self.pause_redraw and self._pixel_redraw_queue:
2335-
_old_position, _new_position, _force_monitor = self._pixel_redraw_queue.pop()
2336-
self.draw_pixmap_line(_old_position, _new_position, _force_monitor)
2334+
if not self.pause_redraw and self._pixel_redraw_queue:
2335+
redraw, self._pixel_redraw_queue = self._pixel_redraw_queue, []
2336+
for _old_position, _new_position, _force_monitor in redraw:
2337+
self.draw_pixmap_line(_old_position, _new_position, _force_monitor)
23372338

23382339
def update_thumbnail_size(self) -> None:
23392340
"""Set a new thumbnail size after the window has finished resizing."""

0 commit comments

Comments
 (0)