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:
@@ -262,9 +262,10 @@ Canvas::BlendLayer(Layer* layer)
|
|||||||
fDrawState->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE);
|
fDrawState->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE);
|
||||||
fDrawState->SetTransformEnabled(false);
|
fDrawState->SetTransformEnabled(false);
|
||||||
|
|
||||||
AlphaMask* mask = new UniformAlphaMask(layer->Opacity());
|
AlphaMask* mask = new(std::nothrow) UniformAlphaMask(layer->Opacity());
|
||||||
if (mask == NULL) {
|
if (mask == NULL) {
|
||||||
layerBitmap->ReleaseReference();
|
layerBitmap->ReleaseReference();
|
||||||
|
layer->ReleaseReference();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +300,12 @@ OffscreenCanvas::OffscreenCanvas(DrawingEngine* engine,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OffscreenCanvas::~OffscreenCanvas()
|
||||||
|
{
|
||||||
|
delete fDrawState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
OffscreenCanvas::ResyncDrawState()
|
OffscreenCanvas::ResyncDrawState()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ class OffscreenCanvas : public Canvas {
|
|||||||
public:
|
public:
|
||||||
OffscreenCanvas(DrawingEngine* engine,
|
OffscreenCanvas(DrawingEngine* engine,
|
||||||
const DrawState& state, const IntRect& bounds);
|
const DrawState& state, const IntRect& bounds);
|
||||||
|
virtual ~OffscreenCanvas();
|
||||||
|
|
||||||
virtual DrawingEngine* GetDrawingEngine() const { return fDrawingEngine; }
|
virtual DrawingEngine* GetDrawingEngine() const { return fDrawingEngine; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user