diff options
author | Mike Klein <mtklein@chromium.org> | 2017-04-07 14:18:29 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-07 19:06:12 +0000 |
commit | 149e42ed194e09ed273a131cd25d0d4a4a1fe64b (patch) | |
tree | 044f9a649e00f44f90d6cef52f001e2c8996bad0 /include/private/SkTemplates.h | |
parent | 266dcb05995e2c06544c4a1456264bd9b86180f8 (diff) |
make SkAutoTMalloc self-move safe
We were just combing through possible changes that might have affected
the attached bug, this popped out as pretty obviously unsafe.
This doesn't explain the Chrome bug...
SkAutoTMalloc and SKAutoSTMalloc are separate types. :(
The new test fails and crashes before, passes after.
Change-Id: I033f488a7f644b7a70e612c8535fedfac35c76db
Reviewed-on: https://skia-review.googlesource.com/11797
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'include/private/SkTemplates.h')
-rw-r--r-- | include/private/SkTemplates.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/private/SkTemplates.h b/include/private/SkTemplates.h index 351fcccfc3..919d160d0d 100644 --- a/include/private/SkTemplates.h +++ b/include/private/SkTemplates.h @@ -294,8 +294,10 @@ public: } SkAutoTMalloc& operator=(SkAutoTMalloc<T>&& that) { - sk_free(fPtr); - fPtr = that.release(); + if (this != &that) { + sk_free(fPtr); + fPtr = that.release(); + } return *this; } |