mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 913805 - Hold a lock on the RasterImage in ScaleRequest so that the srcFrame doesn't go away if we need to discard images to free up memory r=seth
This commit is contained in:
parent
5de925be63
commit
c371700a13
@ -211,13 +211,16 @@ public:
|
||||
|
||||
bool success = false;
|
||||
if (!dstLocked) {
|
||||
// We need to hold a lock onto the RasterImage object itself so that
|
||||
// it (and its associated imgFrames) aren't marked as discardable.
|
||||
bool imgLocked = NS_SUCCEEDED(image->LockImage());
|
||||
bool srcLocked = NS_SUCCEEDED(srcFrame->LockImageData());
|
||||
srcSurface = srcFrame->GetSurface();
|
||||
|
||||
dstLocked = NS_SUCCEEDED(dstFrame->LockImageData());
|
||||
dstSurface = dstFrame->GetSurface();
|
||||
|
||||
success = srcLocked && dstLocked && srcSurface && dstSurface;
|
||||
success = imgLocked && srcLocked && dstLocked && srcSurface && dstSurface;
|
||||
|
||||
if (success) {
|
||||
srcData = srcFrame->GetImageData();
|
||||
@ -253,6 +256,7 @@ public:
|
||||
if (DiscardingEnabled())
|
||||
dstFrame->SetDiscardable();
|
||||
success = NS_SUCCEEDED(dstFrame->UnlockImageData());
|
||||
success = success && NS_SUCCEEDED(image->UnlockImage());
|
||||
|
||||
dstLocked = false;
|
||||
srcData = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user