[Digikam-devel] extragear/graphics/digikam/libs/dimg

Caulier Gilles caulier.gilles at free.fr
Sun Jan 22 09:13:23 CET 2006


Le Samedi 21 Janvier 2006 23:37, Marcel Wiesweg a écrit :

THANKS YOU very much Marcel. Great hacking !!! I have trying to solve this 
problem since a long time in the past without sucess...

Gilles

> SVN commit 501049 by mwiesweg:
>
> digikam from trunk: Dimg fixes
>
> - fix memory leak: added missing deref() in DImg::copy()
>   The object that is copied would leak its memory
> - fix crash in jpegloader
>
> CCMAIL:digikam-devel at kde.org
>
>
>
>  M  +2 -0      dimg.cpp
>  M  +1 -1      dimgloader.cpp
>  M  +6 -6      loaders/jpegloader.cpp
>
>
> --- trunk/extragear/graphics/digikam/libs/dimg/dimg.cpp #501048:501049
> @@ -780,6 +780,8 @@
>          m_priv->data = new uchar[size];
>          memcpy(m_priv->data, old->data, size);
>      }
> +
> +    old->deref();
>  }
>
>  void DImg::crop(QRect rect)
> --- trunk/extragear/graphics/digikam/libs/dimg/dimgloader.cpp
> #501048:501049 @@ -40,7 +40,7 @@
>      // Progress slice is the part of 100% concerned with the current
> granularity // (E.g. in a loop only the values from 10% to 90% are used,
> then progressSlice is 0.8) // Current default is 1/20, that is progress
> info every 5%
> -    int granularity = (total / (20 * progressSlice)) /
> observer->granularity(); +    int granularity = (int)(( total / (20 *
> progressSlice)) / observer->granularity()); return granularity ?
> granularity : 1;
>  }
>
> --- trunk/extragear/graphics/digikam/libs/dimg/loaders/jpegloader.cpp
> #501048:501049 @@ -171,7 +171,7 @@
>
>      int w = cinfo.output_width;
>      int h = cinfo.output_height;
> -    uchar *dest;
> +    uchar *dest = 0;
>
>      if (loadImageData)
>      {
> @@ -205,9 +205,9 @@
>              return false;
>          }
>
> -        ptr2 = new uchar[w * h * 4];
> +        dest = new uchar[w * h * 4];
>
> -        if (!ptr2)
> +        if (!dest)
>          {
>              delete [] data;
>              jpeg_destroy_decompress(&cinfo);
> @@ -216,7 +216,7 @@
>              return false;
>          }
>
> -        dest  = ptr2;
> +        ptr2  = dest;
>          count = 0;
>          prevy = 0;
>
> @@ -235,7 +235,7 @@
>                      if (!observer->continueQuery(m_image))
>                      {
>                          delete [] data;
> -                        delete [] ptr2;
> +                        delete [] dest;
>                          jpeg_destroy_decompress(&cinfo);
>                          fclose(file);
>                          return false;
> @@ -280,7 +280,7 @@
>                      if (!observer->continueQuery(m_image))
>                      {
>                          delete [] data;
> -                        delete [] ptr2;
> +                        delete [] dest;
>                          jpeg_destroy_decompress(&cinfo);
>                          fclose(file);
>                          return false;
> _______________________________________________
> Digikam-devel mailing list
> Digikam-devel at kde.org
> https://mail.kde.org/mailman/listinfo/digikam-devel


More information about the Digikam-devel mailing list