Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: src/pdf/SkPDFShader.cpp

Issue 19509005: If we fail to contruct the Pdf Image Shader, mark the object as busted, and dn't try to remove it f… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFShader.cpp
===================================================================
--- src/pdf/SkPDFShader.cpp (revision 10235)
+++ src/pdf/SkPDFShader.cpp (working copy)
@@ -444,8 +444,10 @@
public:
explicit SkPDFImageShader(SkPDFShader::State* state);
virtual ~SkPDFImageShader() {
- RemoveShader(this);
- fResources.unrefAll();
+ if (isValid()) {
+ RemoveShader(this);
+ fResources.unrefAll();
vandebo (ex-Chrome) 2013/07/23 17:29:00 If it isn't valid, fResources should be empty, but
edisonn 2013/07/23 17:35:39 Done.
+ }
}
virtual bool isValid() { return size() > 0; }
@@ -511,6 +513,9 @@
result = functionShader;
}
if (!valid) {
+ // Release the lock, otherwise we end up calling RemoveShader that
vandebo (ex-Chrome) 2013/07/23 17:29:00 With the isValid() check in the destructor, you do
edisonn 2013/07/23 17:35:39 true for image shader, but I am not 100% for funct
vandebo (ex-Chrome) 2013/07/23 17:47:33 All the early exits are before fResources is popul
edisonn 2013/07/23 17:54:13 done (function shader already has the valid check
+ // locks again, and we end up with a freeze.
+ lock.release();
delete result;
return NULL;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698