Bug 1074192 - Hold the mutex in imgFrame when creating a DrawableFrameRef; r?tnikkel
MozReview-Commit-ID: 5G4bQdLAhgC
--- a/image/imgFrame.h
+++ b/image/imgFrame.h
@@ -473,16 +473,19 @@ class DrawableFrameRef final
typedef gfx::DataSourceSurface DataSourceSurface;
public:
DrawableFrameRef() { }
explicit DrawableFrameRef(imgFrame* aFrame)
: mFrame(aFrame)
{
+ MOZ_ASSERT(aFrame);
+ MonitorAutoLock lock(aFrame->mMonitor);
+
// Paletted images won't have a surface so there is no strong reference
// to hold on to. Since Draw() and GetSourceSurface() calls will not work
// in that case, we should be using RawAccessFrameRef exclusively instead.
// See FrameAnimator::GetRawFrame for an example of this behaviour.
if (aFrame->mRawSurface) {
mRef = new DataSourceSurface::ScopedMap(aFrame->mRawSurface,
DataSourceSurface::READ_WRITE);
if (!mRef->IsMapped()) {