Handles are generated by the `tumbler_scheduler_request_new` function. Here is the current code ( https://gitlab.xfce.org/xfce/tumbler/-/blob/3520322eb453ee1349b14b080a0f7d23e4040b16/tumblerd/tumbler-scheduler.c#L264 ): > TumblerSchedulerRequest * > tumbler_scheduler_request_new (TumblerFileInfo **infos, > TumblerThumbnailer **thumbnailers, > guint length, > const gchar *origin) > { > TumblerSchedulerRequest *request = NULL; > static gint handle = 0; > guint n; > > g_return_val_if_fail (infos != NULL, NULL); > g_return_val_if_fail (thumbnailers != NULL, NULL); > > request = g_new0 (TumblerSchedulerRequest, 1); > if (origin) > request->origin = g_strdup (origin); > request->dequeued = FALSE; > request->scheduler = NULL; > request->handle = handle++; The problem with this code is that it starts from 0, while the specification ( https://wiki.gnome.org/DraftSpecs/ThumbnailerSpec#Request_the_creation_of_thumbnails ) says that the handle can not be 0: > Queue (Request the creation of thumbnails): > This method always returns a handle different than 0. My proposed solution is to change the initial value of the `handle` variable here from 0 to 1. This will change the generated sequence from `0, 1, 2, ...` to `1, 2, 3, ...`. Here is the Merge Request: https://gitlab.xfce.org/xfce/tumbler/-/merge_requests/1
Here is a bug in Thunar which led me to finding this issue: https://bugzilla.xfce.org/show_bug.cgi?id=14122#c1
(In reply to afdw from comment #0) > > This method always returns a handle different than 0. * Will additional checks be needed so that the zero handle will never be returned? * Should calling programs choose an error response for a received zero handle?
(In reply to Markus Elfring from comment #2) > (In reply to afdw from comment #0) > > > This method always returns a handle different than 0. > * Will additional checks be needed so that the zero handle will never be > returned? No, I do no think additional checks in Tumbler are needed as longs as there are no more related bugs.
(In reply to afdw from comment #3) > No, I do no think additional checks in Tumbler are needed as longs as there are no more related bugs. How do you think about the possibility that the used counter would wrap around so that a zero handle could eventually be returned again for a request so far?
(In reply to afdw from comment #0) … > https://gitlab.xfce.org/xfce/tumbler/-/blob/3520322eb453ee1349b14b080a0f7d23e4040b16/tumblerd/tumbler-scheduler.c#L264 ): > > TumblerSchedulerRequest * > > tumbler_scheduler_request_new (TumblerFileInfo **infos, > > TumblerThumbnailer **thumbnailers, > > guint length, > > const gchar *origin) > > { … > > static gint handle = 0; … > > request->handle = handle++; > The problem with this code is that it starts from 0, … How do you think about the possibility to replace the increment operator instead? request->handle = ++handle;
(In reply to Markus Elfring from comment #4) > (In reply to afdw from comment #3) > > No, I do no think additional checks in Tumbler are needed as longs as there are no more related bugs. > How do you think about the possibility that the used counter would wrap > around so that a zero handle could eventually be returned again for a > request so far? (In reply to Markus Elfring from comment #5) > (In reply to afdw from comment #0) > … > > https://gitlab.xfce.org/xfce/tumbler/-/blob/3520322eb453ee1349b14b080a0f7d23e4040b16/tumblerd/tumbler-scheduler.c#L264 ): > > > TumblerSchedulerRequest * > > > tumbler_scheduler_request_new (TumblerFileInfo **infos, > > > TumblerThumbnailer **thumbnailers, > > > guint length, > > > const gchar *origin) > > > { > … > > > static gint handle = 0; > … > > > request->handle = handle++; > > The problem with this code is that it starts from 0, … > How do you think about the possibility to replace the increment operator > instead? > request->handle = ++handle; Answered on GitLab.
(In reply to afdw from comment #6) > Answered on GitLab. I find that implementation details should get further software development attention also for this issue. * Correct data type for the request handle https://bugzilla.xfce.org/show_bug.cgi?id=16833 * Make request management safer https://bugzilla.xfce.org/show_bug.cgi?id=16842