diff --git a/src/servers/app/Canvas.cpp b/src/servers/app/Canvas.cpp index 8781aca427..55f273bf03 100644 --- a/src/servers/app/Canvas.cpp +++ b/src/servers/app/Canvas.cpp @@ -262,9 +262,10 @@ Canvas::BlendLayer(Layer* layer) fDrawState->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE); fDrawState->SetTransformEnabled(false); - AlphaMask* mask = new UniformAlphaMask(layer->Opacity()); + AlphaMask* mask = new(std::nothrow) UniformAlphaMask(layer->Opacity()); if (mask == NULL) { layerBitmap->ReleaseReference(); + layer->ReleaseReference(); return; } @@ -299,6 +300,12 @@ OffscreenCanvas::OffscreenCanvas(DrawingEngine* engine, } +OffscreenCanvas::~OffscreenCanvas() +{ + delete fDrawState; +} + + void OffscreenCanvas::ResyncDrawState() { diff --git a/src/servers/app/Canvas.h b/src/servers/app/Canvas.h index 952910564f..986dceef25 100644 --- a/src/servers/app/Canvas.h +++ b/src/servers/app/Canvas.h @@ -91,6 +91,7 @@ class OffscreenCanvas : public Canvas { public: OffscreenCanvas(DrawingEngine* engine, const DrawState& state, const IntRect& bounds); + virtual ~OffscreenCanvas(); virtual DrawingEngine* GetDrawingEngine() const { return fDrawingEngine; }