From 382aab381b3fbb97e64e5010fbce7f3793ff703a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 8 Jun 2018 13:05:49 +0200 Subject: [PATCH] hold and return SalI18NImeStatus using std::unique_ptr Change-Id: I3657980045290a4d65b2944afac04d610c0a94fd Reviewed-on: https://gerrit.libreoffice.org/55496 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/inc/salinst.hxx | 4 ++-- vcl/inc/svdata.hxx | 2 +- vcl/inc/unx/gtk/gtkinst.hxx | 2 +- vcl/inc/unx/salinst.h | 2 +- vcl/source/app/salvtables.cxx | 4 ++-- vcl/source/app/svmain.cxx | 3 +-- vcl/unx/generic/app/i18n_status.cxx | 4 ++-- vcl/unx/gtk/gtkinst.cxx | 3 ++- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index b4e8ed85e4d8..346352486b30 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -127,8 +127,8 @@ public: // SalTimer virtual SalTimer* CreateSalTimer() = 0; - // SalI18NImeStatus - virtual SalI18NImeStatus* + // interface to ime status window, only used by the X11 backend + virtual std::unique_ptr CreateI18NImeStatus(); // SalSystem virtual SalSystem* CreateSalSystem() = 0; diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 09cd76695b62..233ff8add528 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -340,7 +340,7 @@ struct ImplSVData Application* mpApp = nullptr; // pApp VclPtr mpDefaultWin; // Default-Window bool mbDeInit = false; // Is VCL deinitializing - SalI18NImeStatus* mpImeStatus = nullptr; // interface to ime status window + std::unique_ptr mpImeStatus; // interface to ime status window, only used by the X11 backend SalSystem* mpSalSystem = nullptr; // SalSystem interface bool mbResLocaleSet = false; // SV-Resource-Manager std::locale maResLocale; // Resource locale diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index 41ba5675df0b..aea9e0223fe6 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -193,7 +193,7 @@ public: virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override; #if !GTK_CHECK_VERSION(3,0,0) - virtual SalI18NImeStatus* CreateI18NImeStatus() override; + virtual std::unique_ptr CreateI18NImeStatus() override; #endif virtual SalSystem* CreateSalSystem() override; virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup) override; diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h index a35c2755b5d8..2e404dbe76e8 100644 --- a/vcl/inc/unx/salinst.h +++ b/vcl/inc/unx/salinst.h @@ -69,7 +69,7 @@ public: virtual GenPspGraphics *CreatePrintGraphics() override; virtual SalTimer* CreateSalTimer() override; - virtual SalI18NImeStatus* CreateI18NImeStatus() override; + virtual std::unique_ptr CreateI18NImeStatus() override; virtual SalSystem* CreateSalSystem() override; virtual SalBitmap* CreateSalBitmap() override; virtual SalSession* CreateSalSession() override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 0772b53943ee..ca3b6fb3aa00 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -107,9 +107,9 @@ bool SalInstance::CallEventCallback( void const * pEvent, int nBytes ) return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); } -SalI18NImeStatus* SalInstance::CreateI18NImeStatus() +std::unique_ptr SalInstance::CreateI18NImeStatus() { - return new SalI18NImeStatus; + return std::unique_ptr(new SalI18NImeStatus); } SalTimer::~SalTimer() COVERITY_NOEXCEPT_FALSE diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index bd7a4d6890ea..c2de4819b541 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -433,8 +433,7 @@ void DeInitVCL() vcl::DeleteOnDeinitBase::ImplDeleteOnDeInit(); // give ime status a chance to destroy its own windows - delete pSVData->mpImeStatus; - pSVData->mpImeStatus = nullptr; + pSVData->mpImeStatus.reset(); #if OSL_DEBUG_LEVEL > 0 OStringBuffer aBuf( 256 ); diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx index c80846e621ca..6a27ed8ac6c7 100644 --- a/vcl/unx/generic/app/i18n_status.cxx +++ b/vcl/unx/generic/app/i18n_status.cxx @@ -431,9 +431,9 @@ void X11ImeStatus::toggle() vcl::I18NStatus::get().toggleStatusWindow(); } -SalI18NImeStatus* X11SalInstance::CreateI18NImeStatus() +std::unique_ptr X11SalInstance::CreateI18NImeStatus() { - return new X11ImeStatus(); + return std::unique_ptr(new X11ImeStatus()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx index 42bb9e6e2423..4e168ca6dcf2 100644 --- a/vcl/unx/gtk/gtkinst.cxx +++ b/vcl/unx/gtk/gtkinst.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -226,7 +227,7 @@ SalObject* GtkInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWind } #if !GTK_CHECK_VERSION(3,0,0) -SalI18NImeStatus* GtkInstance::CreateI18NImeStatus() +std::unique_ptr GtkInstance::CreateI18NImeStatus() { //we want the default SalInstance::CreateI18NImeStatus returns the no-op //stub here, not the X11Instance::CreateI18NImeStatus which the gtk2