Kaydet (Commit) 807d9a7d authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS vcl85_SRC680 (1.29.162); FILE MERGED

2008/01/08 16:30:59 pl 1.29.162.1: #i82997# catch bad alloc exception
üst c42534aa
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: salbmp.cxx,v $ * $RCSfile: salbmp.cxx,v $
* *
* $Revision: 1.29 $ * $Revision: 1.30 $
* *
* last change: $Author: hr $ $Date: 2007-06-27 20:49:34 $ * last change: $Author: rt $ $Date: 2008-01-29 16:23:15 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -138,11 +138,18 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount, ...@@ -138,11 +138,18 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount,
{ {
DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24, "Unsupported BitCount!" ); DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24, "Unsupported BitCount!" );
BitmapBuffer* pDIB; BitmapBuffer* pDIB = NULL;
if( rSize.Width() && rSize.Height() ) if( rSize.Width() && rSize.Height() )
{
try
{ {
pDIB = new BitmapBuffer; pDIB = new BitmapBuffer;
}
catch( std::bad_alloc& )
{
pDIB = NULL;
}
if( pDIB ) if( pDIB )
{ {
...@@ -179,8 +186,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount, ...@@ -179,8 +186,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount,
pDIB->maPalette.SetEntryCount( nColors ); pDIB->maPalette.SetEntryCount( nColors );
} }
try
{
pDIB->mpBits = new BYTE[ pDIB->mnScanlineSize * pDIB->mnHeight ]; pDIB->mpBits = new BYTE[ pDIB->mnScanlineSize * pDIB->mnHeight ];
} }
catch(std::bad_alloc&)
{
delete pDIB;
pDIB = NULL;
}
}
} }
else else
pDIB = NULL; pDIB = NULL;
...@@ -708,7 +723,15 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp ) ...@@ -708,7 +723,15 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp )
// TODO: reference counting... // TODO: reference counting...
mpDIB = new BitmapBuffer( *rSalBmp.mpDIB ); mpDIB = new BitmapBuffer( *rSalBmp.mpDIB );
// TODO: get rid of this when BitmapBuffer gets copy constructor // TODO: get rid of this when BitmapBuffer gets copy constructor
try
{
mpDIB->mpBits = new BYTE[ mpDIB->mnScanlineSize * mpDIB->mnHeight ]; mpDIB->mpBits = new BYTE[ mpDIB->mnScanlineSize * mpDIB->mnHeight ];
}
catch( std::bad_alloc& )
{
delete mpDIB;
mpDIB = NULL;
}
if( mpDIB ) if( mpDIB )
memcpy( mpDIB->mpBits, rSalBmp.mpDIB->mpBits, mpDIB->mnScanlineSize * mpDIB->mnHeight ); memcpy( mpDIB->mpBits, rSalBmp.mpDIB->mpBits, mpDIB->mnScanlineSize * mpDIB->mnHeight );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment