diff options
author | 2011-08-09 19:25:05 +0000 | |
---|---|---|
committer | 2011-08-09 19:25:05 +0000 | |
commit | a9e586a21f7c13d12e3662d95ae34ad64cc00f95 (patch) | |
tree | 4c544bab3630a2500fae88456751011be3847e1b /include | |
parent | 208c590219d13398c12996baf9f50407532bf424 (diff) |
Add means to release object from ScopedComPtr.
http://codereview.appspot.com/4801088/
git-svn-id: http://skia.googlecode.com/svn/trunk@2090 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/utils/win/SkTScopedComPtr.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/utils/win/SkTScopedComPtr.h b/include/utils/win/SkTScopedComPtr.h index 68a0a81336..e0d1634cb8 100644 --- a/include/utils/win/SkTScopedComPtr.h +++ b/include/utils/win/SkTScopedComPtr.h @@ -20,10 +20,7 @@ private: public: explicit SkTScopedComPtr(T *ptr = NULL) : fPtr(ptr) { } ~SkTScopedComPtr() { - if (NULL != fPtr) { - fPtr->Release(); - fPtr = NULL; - } + this->reset(); } T &operator*() const { return *fPtr; } T *operator->() const { return fPtr; } @@ -35,6 +32,12 @@ public: */ T **operator&() { SkASSERT(fPtr == NULL); return &fPtr; } T *get() const { return fPtr; } + void reset() { + if (NULL != this->fPtr) { + this->fPtr->Release(); + this->fPtr = NULL; + } + } }; #endif |