[Libreoffice-commits] core.git: vcl/inc vcl/source vcl/unx

Noel Grandin noel.grandin at collabora.co.uk
Sat Jun 9 07:53:05 UTC 2018


 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(-)

New commits:
commit 382aab381b3fbb97e64e5010fbce7f3793ff703a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Jun 8 13:05:49 2018 +0200

    hold and return SalI18NImeStatus using std::unique_ptr
    
    Change-Id: I3657980045290a4d65b2944afac04d610c0a94fd
    Reviewed-on: https://gerrit.libreoffice.org/55496
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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<SalI18NImeStatus>
                             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<WorkWindow>      mpDefaultWin;                   // Default-Window
     bool                    mbDeInit = false;               // Is VCL deinitializing
-    SalI18NImeStatus*       mpImeStatus = nullptr;          // interface to ime status window
+    std::unique_ptr<SalI18NImeStatus> 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<SalI18NImeStatus> 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<SalI18NImeStatus> 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<SalI18NImeStatus> SalInstance::CreateI18NImeStatus()
 {
-    return new SalI18NImeStatus;
+    return std::unique_ptr<SalI18NImeStatus>(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<SalI18NImeStatus> X11SalInstance::CreateI18NImeStatus()
 {
-    return new X11ImeStatus();
+    return std::unique_ptr<SalI18NImeStatus>(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 <unx/gtk/gtksalmenu.hxx>
 #include <headless/svpvd.hxx>
 #include <headless/svpbmp.hxx>
+#include <salimestatus.hxx>
 #include <vcl/inputtypes.hxx>
 #include <unx/genpspgraphics.h>
 #include <rtl/strbuf.hxx>
@@ -226,7 +227,7 @@ SalObject* GtkInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWind
 }
 
 #if !GTK_CHECK_VERSION(3,0,0)
-SalI18NImeStatus* GtkInstance::CreateI18NImeStatus()
+std::unique_ptr<SalI18NImeStatus> GtkInstance::CreateI18NImeStatus()
 {
     //we want the default SalInstance::CreateI18NImeStatus returns the no-op
     //stub here, not the X11Instance::CreateI18NImeStatus which the gtk2


More information about the Libreoffice-commits mailing list