[Spice-devel] [spice-html5 stream 4/5] Setting src to null generates console log messages.

Pavel Grunt pgrunt at redhat.com
Wed Oct 5 05:56:39 UTC 2016


Hi,
maybe:
"Use empty image instead of null to avoid warnings"


On Wed, 2016-09-28 at 15:32 -0500, Jeremy White wrote:
> Instead, let's set it to an empty gif.  Should have the
> same benefit.
> 
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
Acked-by: Pavel Grunt <pgrunt at redhat.com>
> ---
>  display.js | 2 +-
>  utils.js   | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/display.js b/display.js
> index 6c6b962..d9bdd9f 100644
> --- a/display.js
> +++ b/display.js
> @@ -933,7 +933,7 @@ function handle_draw_jpeg_onload()
>  
>          // Give the Garbage collector a clue to recycle this;
> avoids
>          //  fairly massive memory leaks during video playback
> -        this.src = null;
> +        this.src = EMPTY_GIF_IMAGE;
>  
>          if (this.o.descriptor &&
>              (this.o.descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME))
> diff --git a/utils.js b/utils.js
> index 9093a24..4930fe8 100644
> --- a/utils.js
> +++ b/utils.js
> @@ -27,6 +27,11 @@ var STREAM_DEBUG = 0;
>  var DUMP_DRAWS = false;
>  var DUMP_CANVASES = false;
>  
> +/*-----------------------------------------------------------------
> -----------
> +**  We use an Image temporarily, and the image/src does not get
> garbage
> +**   collected as quickly as we might like.  This blank image helps
> with that.
> +**-----------------------------------------------------------------
> ---------*/
> +var EMPTY_GIF_IMAGE =
> "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
>  
>  /*-----------------------------------------------------------------
> -----------
>  **  combine_array_buffers
> 


More information about the Spice-devel mailing list