mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
GRAPHICS: Fix leak in managed surface
In the case of the ManagedSurface constructor from a Surface object, _disposeAfterUse is not initialized. But more, copyFrom() sets _disposeAfterUse to YES after allocation of buffer. And then, after the call to copyFrom, _disposeAfterUse was set to NO, what made the pixels buffer not freed.
This commit is contained in:
parent
032d030060
commit
deefffd983
@ -101,8 +101,8 @@ ManagedSurface::ManagedSurface(const Surface *surf) :
|
||||
return;
|
||||
}
|
||||
|
||||
copyFrom(*surf);
|
||||
_disposeAfterUse = DisposeAfterUse::NO;
|
||||
copyFrom(*surf);
|
||||
}
|
||||
|
||||
ManagedSurface::~ManagedSurface() {
|
||||
|
@ -136,7 +136,7 @@ public:
|
||||
/**
|
||||
* Create a managed surface from plain Surface.
|
||||
*
|
||||
* If disiposeAgter use flag is set (default), the surface will reuse all structures
|
||||
* If disposeAfterUse flag is set (default), the surface will reuse all structures
|
||||
* from the surface and destroy it, otherwise it will make a copy.
|
||||
*/
|
||||
ManagedSurface(Surface *surf, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
|
||||
@ -161,7 +161,7 @@ public:
|
||||
operator const Surface &() const { return _innerSurface; }
|
||||
|
||||
/**
|
||||
* Return the underyling Graphics::Surface
|
||||
* Return the underlying Graphics::Surface
|
||||
*
|
||||
* If a caller uses the non-const surfacePtr version and changes
|
||||
* the surface, they'll be responsible for calling addDirtyRect
|
||||
@ -610,7 +610,7 @@ public:
|
||||
* @param dstFormat The desired format.
|
||||
* @param palette The palette (in RGB888), if the source format has a bpp of 1.
|
||||
*/
|
||||
void convertToInPlace(const PixelFormat &dstFormat, const byte *palette = 0) {
|
||||
void convertToInPlace(const PixelFormat &dstFormat, const byte *palette = nullptr) {
|
||||
_innerSurface.convertToInPlace(dstFormat, palette);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user