Fix for Valgrind reporting loss from QuramBitmapFactory in MCD. 78/46378/3
authorRichard Underhill <r.underhill@partner.samsung.com>
Wed, 19 Aug 2015 15:38:18 +0000 (16:38 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 28 Aug 2015 17:33:12 +0000 (10:33 -0700)
There is a delete[]/free mismatch changed Dali to use malloc/free to
help with third party libraries.

Change-Id: Ib3fbe62f9b00cea5062b44cf1169de1f6dda3bf0
Signed-off-by: Richard Underhill <r.underhill@partner.samsung.com>
dali/integration-api/bitmap.cpp
dali/integration-api/bitmap.h
dali/internal/event/images/bitmap-compressed.cpp
dali/internal/event/images/bitmap-packed-pixel.cpp

index 41d5327..bfff2d5 100644 (file)
@@ -18,8 +18,6 @@
 // CLASS HEADER
 #include <dali/integration-api/bitmap.h>
 
-// EXTERNAL INCLUDES
-
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/platform-abstraction.h>
@@ -290,16 +288,6 @@ void Bitmap::DiscardBuffer()
   }
 }
 
-PixelBuffer* Bitmap::ReleaseBuffer()
-{
-  PixelBuffer* const data = mData;
-
-  // Ownership of mData has been transferred, so indicate that mData pointer is no longer valid:
-  mData = NULL;
-
-  return data;
-}
-
 Bitmap::~Bitmap()
 {
   DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
@@ -320,7 +308,7 @@ void Bitmap::DeletePixelBuffer()
   {
     return;
   }
-  delete [] mData;
+  free ( mData );
   mData = NULL;
 }
 
index 7363abe..6319ae1 100644 (file)
@@ -311,12 +311,6 @@ public:
     return mDiscardable == ResourcePolicy::OWNED_DISCARD;
   }
 
- /**
-   * Transfer ownership of the pixel buffer to the calling function.
-   * @post bitmaps pixel data is set to NULL
-   * @return the bitmaps pixel buffer
-   */
-  PixelBuffer* ReleaseBuffer();
   /**
    * Delete the pixel buffer data
    */
index 7e41ca9..65a01bc 100644 (file)
@@ -18,9 +18,8 @@
 // CLASS HEADER
 #include <dali/internal/event/images/bitmap-compressed.h>
 
-// INTERNAL INCLUDES
-#include <dali/internal/common/core-impl.h>
-#include <dali/integration-api/debug.h>
+// EXTERNAL INCLUDES
+#include <cstdlib>
 
 // INTERNAL INCLUDES
 #include <dali/internal/common/core-impl.h>
@@ -66,7 +65,7 @@ Dali::Integration::PixelBuffer* BitmapCompressed::ReserveBufferOfSize( Pixel::Fo
 
   Initialize(pixelFormat, width, height, bufferSize);
 
-  mData = new Dali::Integration::PixelBuffer[bufferSize];
+  mData = reinterpret_cast< Dali::Integration::PixelBuffer* >( malloc( bufferSize ) );
 
   return mData;
 }
index d97b1d4..232877f 100644 (file)
@@ -18,6 +18,9 @@
 // CLASS HEADER
 #include <dali/internal/event/images/bitmap-packed-pixel.h>
 
+// EXTERNAL INCLUDES
+#include <cstdlib>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/object/ref-object.h>
 #include <dali/internal/common/core-impl.h>
@@ -54,7 +57,7 @@ Dali::Integration::PixelBuffer* BitmapPackedPixel::ReserveBuffer(Pixel::Format p
   //allocate buffer
   unsigned int bufSize = mBufferWidth * mBufferHeight * mBytesPerPixel;
 
-  mData = new Dali::Integration::PixelBuffer[bufSize];
+  mData = reinterpret_cast< Dali::Integration::PixelBuffer* >( malloc( bufSize) );
 
   return mData;
 }