Kaydet (Commit) b9c46a57 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SalDisplay

Change-Id: I33cab261f107ed29e36d0093a87ffc3a2de21a54
Reviewed-on: https://gerrit.libreoffice.org/53361Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst c5ad9252
...@@ -280,7 +280,7 @@ protected: ...@@ -280,7 +280,7 @@ protected:
KeySym nCtrlKeySym_; // first control modifier KeySym nCtrlKeySym_; // first control modifier
KeySym nMod1KeySym_; // first mod1 modifier KeySym nMod1KeySym_; // first mod1 modifier
vcl_sal::WMAdaptor* m_pWMAdaptor; std::unique_ptr<vcl_sal::WMAdaptor> m_pWMAdaptor;
bool m_bXinerama; bool m_bXinerama;
std::vector< tools::Rectangle > m_aXineramaScreens; std::vector< tools::Rectangle > m_aXineramaScreens;
...@@ -367,7 +367,7 @@ public: ...@@ -367,7 +367,7 @@ public:
SalI18N_KeyboardExtension* GetKbdExtension() const { return mpKbdExtension; } SalI18N_KeyboardExtension* GetKbdExtension() const { return mpKbdExtension; }
void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension) void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension)
{ mpKbdExtension = pKbdExtension; } { mpKbdExtension = pKbdExtension; }
::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; } ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor.get(); }
bool IsXinerama() const { return m_bXinerama; } bool IsXinerama() const { return m_bXinerama; }
const std::vector< tools::Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; } const std::vector< tools::Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; }
::Window GetRootWindow( SalX11Screen nXScreen ) const ::Window GetRootWindow( SalX11Screen nXScreen ) const
......
...@@ -160,7 +160,7 @@ public: ...@@ -160,7 +160,7 @@ public:
/* /*
* creates a valid WMAdaptor instance for the SalDisplay * creates a valid WMAdaptor instance for the SalDisplay
*/ */
static WMAdaptor* createWMAdaptor( SalDisplay* ); static std::unique_ptr<WMAdaptor> createWMAdaptor( SalDisplay* );
/* /*
* may return an empty string if the window manager could * may return an empty string if the window manager could
......
...@@ -321,8 +321,7 @@ void SalDisplay::doDestruct() ...@@ -321,8 +321,7 @@ void SalDisplay::doDestruct()
{ {
GenericUnixSalData *pData = GetGenericUnixSalData(); GenericUnixSalData *pData = GetGenericUnixSalData();
delete m_pWMAdaptor; m_pWMAdaptor.reset();
m_pWMAdaptor = nullptr;
X11SalBitmap::ImplDestroyCache(); X11SalBitmap::ImplDestroyCache();
X11SalGraphics::releaseGlyphPeer(); X11SalGraphics::releaseGlyphPeer();
......
...@@ -172,16 +172,15 @@ static int compareProtocol( const void* pLeft, const void* pRight ) ...@@ -172,16 +172,15 @@ static int compareProtocol( const void* pLeft, const void* pRight )
} }
} }
WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay ) std::unique_ptr<WMAdaptor> WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
{ {
WMAdaptor* pAdaptor = nullptr; std::unique_ptr<WMAdaptor> pAdaptor;
// try a NetWM // try a NetWM
pAdaptor = new NetWMAdaptor( pSalDisplay ); pAdaptor.reset(new NetWMAdaptor( pSalDisplay ));
if( ! pAdaptor->isValid() ) if( ! pAdaptor->isValid() )
{ {
delete pAdaptor; pAdaptor.reset();
pAdaptor = nullptr;
} }
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
else else
...@@ -191,11 +190,10 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay ) ...@@ -191,11 +190,10 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
// try a GnomeWM // try a GnomeWM
if( ! pAdaptor ) if( ! pAdaptor )
{ {
pAdaptor = new GnomeWMAdaptor( pSalDisplay ); pAdaptor.reset(new GnomeWMAdaptor( pSalDisplay ));
if( ! pAdaptor->isValid() ) if( ! pAdaptor->isValid() )
{ {
delete pAdaptor; pAdaptor.reset();
pAdaptor = nullptr;
} }
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
else else
...@@ -204,7 +202,7 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay ) ...@@ -204,7 +202,7 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
} }
if( ! pAdaptor ) if( ! pAdaptor )
pAdaptor = new WMAdaptor( pSalDisplay ); pAdaptor.reset(new WMAdaptor( pSalDisplay ));
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
fprintf(stderr, "Window Manager's name is \"%s\"\n", fprintf(stderr, "Window Manager's name is \"%s\"\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment