On 05/16/2018 01:29 PM, Enrico Forestieri wrote: > On Wed, May 16, 2018 at 01:09:43PM -0400, Richard Kimberly Heck wrote: >> On 05/16/2018 01:06 PM, Enrico Forestieri wrote: >>> On Wed, May 16, 2018 at 10:01:16AM +0200, Jean-Marc Lasgouttes wrote: >>>> Le 15/05/2018 à 19:51, Enrico Forestieri a écrit : >>>>>> The problem seems to be in the calling code. This seems to happen for >>>>>> svgz >>>>>> files (compressed svg files). >>>>> Actually, it seems to happen when the same image is included multiple >>>>> times, irrespective of the type. See attached example. >>>>> >>>>> Bisect leads to a31d3dc6 as the commit that introduced this issue. >>>> I tried to figure out what happens, but this graphics preview code is a >>>> nightmare to me. Is there someone who can tell me how it works? >>> I don't know that code, so what follows is pure speculation. I think that >>> the preview machinery is activated during the metrics calculation. When >>> an image has to be loaded a second time, its preview is going to be >>> regenerated again, if the cache is not used or if it is not in the cache. >>> In order to do so, most variables are reset, among which also the target >>> format. Now, when the same image appears more than one time on screen, >>> while the first instance is being converted, a request for the second >>> instance is issued, because the image is not in the cache still or the >>> cache is not used. Hence, the same variables that are being used for the >>> preview of the first instance are now cleared while the conversion is >>> still not finished. Bummer. >> Is it possible for us to keep a list of graphics presently being >> converted and refuse to convert the same one twice at the same time? > I really don't know that code, so I cannot answer. However, maybe the > status_ member could be used for that purpose. I simply don't know > where the decision of starting a conversion is taken in the code.
I think you are right that it is during metrics. Tracing some things, RenderGraphic::metrics seems to be responsible for starting the preview, and it gets called from InsetGraphics::metrics. But maybe it is as easy as expanding the cases for which we check in graphics::Loader::startLoading? Riki