git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54943
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/filefn.h"
#include "wx/wfstream.h"
#include "wx/quantize.h"
#include "wx/filefn.h"
#include "wx/wfstream.h"
#include "wx/quantize.h"
+#include "wx/scopeguard.h"
#include "wx/anidecod.h"
// For memcpy
#include "wx/anidecod.h"
// For memcpy
+ static void Free(BMPPalette* pal) { delete [] pal; }
+
bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
int bpp, int ncolors, int comp,
bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
int bpp, int ncolors, int comp,
wxUint16 aWord;
// allocate space for palette if needed:
wxUint16 aWord;
// allocate space for palette if needed:
- cmap = new _cmap[ncolors];
+ cmap = new BMPPalette[ncolors];
if ( !cmap )
{
if (verbose)
if ( !cmap )
{
if (verbose)
+ }
+
+ wxON_BLOCK_EXIT1(&BMPPalette::Free, cmap);
// destroy existing here instead of:
image->Destroy();
// destroy existing here instead of:
image->Destroy();
{
if ( verbose )
wxLogError( _("BMP: Couldn't allocate memory.") );
{
if ( verbose )
wxLogError( _("BMP: Couldn't allocate memory.") );
{
if ( verbose )
wxLogError(_("BMP: Couldn't allocate memory."));
{
if ( verbose )
wxLogError(_("BMP: Couldn't allocate memory."));
image->SetMask(false);
const wxStreamError err = stream.GetLastError();
image->SetMask(false);
const wxStreamError err = stream.GetLastError();