[X2Go-Commits] [pale-moon] 205/294: Bug 1360343 - ensure maskSurface is not null before dereference, since it can be null because of OOM or gfx device reset. r=dvander

git-admin at x2go.org git-admin at x2go.org
Sat Apr 27 08:58:15 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch upstream/28.5.0
in repository pale-moon.

commit 71c0318322ce998ea411f343607de524b2058799
Author: cku <cku at mozilla.com>
Date:   Fri Apr 28 11:48:21 2017 +0800

    Bug 1360343 - ensure maskSurface is not null before dereference, since it can be null because of OOM or gfx device reset. r=dvander
    
    MozReview-Commit-ID: HX2qsWLZpMg
    
    --HG--
    extra : rebase_source : 046befc11151461a682842c31e2ce39247a5e1d8
---
 gfx/2d/2D.h                   | 3 +++
 layout/svg/nsSVGMaskFrame.cpp | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h
index c1fba34..e2020dc 100644
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -488,6 +488,9 @@ public:
   /**
    * Returns a DataSourceSurface with the same data as this one, but
    * guaranteed to have surface->GetType() == SurfaceType::DATA.
+   *
+   * The returning surface might be null, because of OOM or gfx device reset.
+   * The caller needs to do null-check before using it.
    */
   virtual already_AddRefed<DataSourceSurface> GetDataSurface() override;
 
diff --git a/layout/svg/nsSVGMaskFrame.cpp b/layout/svg/nsSVGMaskFrame.cpp
index b8e4b32..a22833d 100644
--- a/layout/svg/nsSVGMaskFrame.cpp
+++ b/layout/svg/nsSVGMaskFrame.cpp
@@ -274,7 +274,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
   }
   RefPtr<DataSourceSurface> maskSurface = maskSnapshot->GetDataSurface();
   DataSourceSurface::MappedSurface map;
-  if (!maskSurface->Map(DataSourceSurface::MapType::READ, &map)) {
+  if (!maskSurface ||
+      !maskSurface->Map(DataSourceSurface::MapType::READ, &map)) {
     return nullptr;
   }
 

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pale-moon.git


More information about the x2go-commits mailing list