diff options
author | Yotam Barnoy | 2010-11-03 22:01:01 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-11-03 22:01:01 +0000 |
commit | 13b904d282ea607db94069b927d6cb1b19aa0d0b (patch) | |
tree | cbc8efcc281f735beb9f45117e82a30872995ac7 /common | |
parent | 0ac1eb82c65e7f20f51f6337df5aa64e02a1af29 (diff) | |
parent | 27182f266f48a6d55dd5d830ed19e2c4285ac1ba (diff) | |
download | scummvm-rg350-13b904d282ea607db94069b927d6cb1b19aa0d0b.tar.gz scummvm-rg350-13b904d282ea607db94069b927d6cb1b19aa0d0b.tar.bz2 scummvm-rg350-13b904d282ea607db94069b927d6cb1b19aa0d0b.zip |
Merge from gsoc2010-plugins
This merge was extremely difficult to carry out. It wasn't entirely SVN's fault -- there were several merges to the branch that were done by hand. Please check for any issues and regressions. Also note that the DS makefile was not copied over since the "one at a time" plugin mode currently has too much fragmentation ie. it doesn't work.
svn-id: r54051
Diffstat (limited to 'common')
-rw-r--r-- | common/ptr.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/common/ptr.h b/common/ptr.h index 7307038936..383b3ee15d 100644 --- a/common/ptr.h +++ b/common/ptr.h @@ -242,15 +242,17 @@ public: */ operator bool() const { return _pointer != 0; } + void deletePointer() { delete _pointer; } + ~ScopedPtr() { - delete _pointer; + deletePointer(); } /** * Resets the pointer with the new value. Old object will be destroyed */ void reset(PointerType o = 0) { - delete _pointer; + deletePointer(); _pointer = o; } @@ -273,10 +275,19 @@ public: return r; } -private: +protected: PointerType _pointer; }; +template<typename T> +class ScopedPtrC : public ScopedPtr<T> { +public: + typedef T *PointerType; + + explicit ScopedPtrC(PointerType o = 0) : ScopedPtr<T>(o) {} + + void deletePointer() { free(ScopedPtr<T>::_pointer); } +}; } // End of namespace Common |