Re: Fix for eog



On Thu, 27 Sep 2001, Jody Goldberg wrote:

> I recently rebuily my entire gnome tree from scratch and ran into
> trouble loading images in gnumeric.  It seems as if zooms are
> temporarily set to something that is much too small during viewer
> size allocation.  The result is a massive allocation by gdk-pixbuf
> and a crash.  I was seeing on the order of 400 Meg for one image.
> Adding a minimum seems to get us past the worst of it.
>
> May I commit ?

I think a fixed limit is better than the massive memory allocation, but in
the future we should dig into this more deeply to fix the root of the
problem.  Although I wonder where the limit of 0.01 comes from. Is this a
arbitrary choosen value or did you run some test cases? However, since
this doesn't affect the GUI of eog in any way, because we have already
only an allowed range of zoom levels, I think it's ok to commit this
patch.

Regards,
   Jens

> Index: eog/libeog/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/eog/libeog/ChangeLog,v
> retrieving revision 1.14
> diff -u -w -r1.14 ChangeLog
> --- eog/libeog/ChangeLog	2001/07/11 19:59:41	1.14
> +++ eog/libeog/ChangeLog	2001/09/27 18:23:29
> @@ -1,3 +1,8 @@
> +2001-09-27  Jody Goldberg <jgoldberg home com>
> +
> +	* image-view.c (image_view_set_zoom) : add a minimum zoom
> +	  to avoid massive memory allocations in gdk-pixbuf.
> +
>  2001-07-11  Lutz Müller <urc8 rz uni-karlsruhe de>
>
>          * Makefile.am: Remove EXTRA_[BONOBO,VFS]_[LIBS,CFLAGS], those are in
> Index: eog/libeog/image-view.c
> ===================================================================
> RCS file: /cvs/gnome/eog/libeog/image-view.c,v
> retrieving revision 1.41
> diff -u -w -r1.41 image-view.c
> --- eog/libeog/image-view.c	2001/07/05 06:52:42	1.41
> +++ eog/libeog/image-view.c	2001/09/27 18:23:30
> @@ -55,6 +55,7 @@
>  /* Maximum zoom factor */
>
>  #define MAX_ZOOM_FACTOR 128
> +#define MIN_ZOOM_FACTOR 0.01
>
>  /* Private part of the ImageView structure */
>  struct _ImageViewPrivate {
> @@ -1669,8 +1670,12 @@
>
>  	if (zoomx > MAX_ZOOM_FACTOR)
>  		zoomx = MAX_ZOOM_FACTOR;
> +	else if (zoomx < MIN_ZOOM_FACTOR)
> +		zoomx = MIN_ZOOM_FACTOR;
>  	if (zoomy > MAX_ZOOM_FACTOR)
>  		zoomy = MAX_ZOOM_FACTOR;
> +	else if (zoomy < MIN_ZOOM_FACTOR)
> +		zoomy = MIN_ZOOM_FACTOR;
>
>  	if (DOUBLE_EQUAL (priv->zoomx, zoomx) &&
>  	    DOUBLE_EQUAL (priv->zoomy, zoomy))
>
> ----- End forwarded message -----
>

-- 
"Wer die Freiheit aufgibt, um Sicherheit zu gewinnen, wird am Ende beides
verlieren." -- Benjamin Franklin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]