Skip to content

Commit

Permalink
thumbnailer: Properly limit request size
Browse files Browse the repository at this point in the history
n_items may have changed between queue_file() and queue_request_timer(),
as a timeout separates them, not a simple g_idle_add.

Fixes: #118
  • Loading branch information
Tamaranch committed Aug 3, 2024
1 parent ba4678d commit 7efa041
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/thumbnailer.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,10 @@ rstto_thumbnailer_queue_request_timer (gpointer user_data)
tumbler_thumbnailer1_call_dequeue_sync (thumbnailer->priv->proxy,
GPOINTER_TO_UINT (iter->data), NULL, NULL);

/* handle current request, whose size doesn't exceed the number of visible items */
for (iter = thumbnailer->priv->queues[flavor], i = 0; iter != NULL; iter = iter->next)
/* handle current request, up to the number of visible items */
for (iter = thumbnailer->priv->queues[flavor], i = 0;
iter != NULL && i < n_items;
iter = iter->next)
{
/* directories are loaded without this costly filtering, so it is done
* here only when required */
Expand Down

0 comments on commit 7efa041

Please sign in to comment.