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

Unified Diff: include/gpu/GrResourceKey.h

Issue 866263007: Fix self assigment in GrResourceKey (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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: include/gpu/GrResourceKey.h
diff --git a/include/gpu/GrResourceKey.h b/include/gpu/GrResourceKey.h
index d500a65657923f4ca2fa304075d5432655c1db8a..15d7b439f10827d7a1fd479987b94d7947cba705 100644
--- a/include/gpu/GrResourceKey.h
+++ b/include/gpu/GrResourceKey.h
@@ -49,10 +49,12 @@ protected:
}
GrResourceKey& operator=(const GrResourceKey& that) {
- size_t bytes = that.size();
- SkASSERT(SkIsAlign4(bytes));
- fKey.reset(SkToInt(bytes / sizeof(uint32_t)));
- memcpy(fKey.get(), that.fKey.get(), bytes);
+ if (this != &that) {
+ size_t bytes = that.size();
+ SkASSERT(SkIsAlign4(bytes));
+ fKey.reset(SkToInt(bytes / sizeof(uint32_t)));
+ memcpy(fKey.get(), that.fKey.get(), bytes);
+ }
return *this;
}
« 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