aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-09 19:25:05 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-09 19:25:05 +0000
commita9e586a21f7c13d12e3662d95ae34ad64cc00f95 (patch)
tree4c544bab3630a2500fae88456751011be3847e1b /include
parent208c590219d13398c12996baf9f50407532bf424 (diff)
Add means to release object from ScopedComPtr.
Diffstat (limited to 'include')
-rw-r--r--include/utils/win/SkTScopedComPtr.h11
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