app_server: plug DrawState instance leak, other minor fixes
* OffscreenCanvas was not deleting its DrawState. Found thanks to the allocation tracking feature in libroot_debug (thanks mmlr!) * Also a missing nothrow and a missing ref release in an error case
This commit is contained in:
parent
bcc5cf7d29
commit
2193dcd799
@ -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()
|
||||
{
|
||||
|
@ -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; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user