diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-07 00:10:51 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-08 18:58:59 +0200 |
commit | dea9f421bdcc77fc1975362f5f06db57f0c412bc (patch) | |
tree | 952eb434b56d437798bbe68a63ac40a0cfa9512c | |
parent | d6f749795b04bb2fb7e9b32122598810bb8c7570 (diff) |
alias sw::UnoImplPtr to ::std::unique_ptr ...feature/unocrsrptr
- ... with a custom deleter
- and kill homegrown implementation
Change-Id: I9babf556dc75772f388d23fd05b916abb4bed497
-rw-r--r-- | sw/inc/unobaseclass.hxx | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx index a4f8abdad413..bfbc9be95f4b 100644 --- a/sw/inc/unobaseclass.hxx +++ b/sw/inc/unobaseclass.hxx @@ -84,39 +84,22 @@ class UnoActionRemoveContext /// helper function for implementing SwClient::Modify void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem *pNew); -#include <boost/utility.hpp> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> namespace sw { - - /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex. - template<typename T> class UnoImplPtr - : private ::boost::noncopyable + template<typename T> + struct UnoImplPtrDeleter { - private: - T * m_p; - - public: - UnoImplPtr(T *const i_p) - : m_p(i_p) - { - SAL_WARN_IF(!i_p, "sw", "UnoImplPtr: null"); - } - - ~UnoImplPtr() - { - SolarMutexGuard g; - delete m_p; // #i105557#: call dtor with locked solar mutex - m_p = 0; - } - - T & operator * () const { return *m_p; } - - T * operator ->() const { return m_p; } - - T * get () const { return m_p; } + void operator()(T* pUnoImpl) + { + SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex + delete pUnoImpl; + } }; + /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex. + template<typename T> + using UnoImplPtr = ::std::unique_ptr<T, UnoImplPtrDeleter<T> >; template< class C > C * UnoTunnelGetImplementation( |