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

loplugin:useuniqueptr in SvpSalInstance

Change-Id: I8cab3c63ba4dcd08488d0fb34d689692d5cf97f9
Reviewed-on: https://gerrit.libreoffice.org/59347
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 82034b04
......@@ -9,6 +9,7 @@
#include <unx/gendata.hxx>
#include <headless/svpinst.hxx>
#include <o3tl/make_unique.hxx>
class SvpSalData : public GenericUnixSalData
{
......@@ -21,7 +22,7 @@ public:
// plugin factory function
SalInstance* svp_create_SalInstance()
{
SvpSalInstance* pInstance = new SvpSalInstance( new SvpSalYieldMutex() );
SvpSalInstance* pInstance = new SvpSalInstance( o3tl::make_unique<SvpSalYieldMutex>() );
new SvpSalData( pInstance );
return pInstance;
}
......
......@@ -63,8 +63,8 @@ static void atfork_child()
#endif
SvpSalInstance::SvpSalInstance( SalYieldMutex *pMutex )
: SalGenericInstance( pMutex )
SvpSalInstance::SvpSalInstance( std::unique_ptr<SalYieldMutex> pMutex )
: SalGenericInstance( std::move(pMutex) )
{
m_aTimeout.tv_sec = 0;
m_aTimeout.tv_usec = 0;
......
......@@ -112,7 +112,7 @@ class VCL_DLLPUBLIC SvpSalInstance : public SalGenericInstance, public SalUserEv
public:
static SvpSalInstance* s_pDefaultInstance;
SvpSalInstance( SalYieldMutex *pMutex );
SvpSalInstance( std::unique_ptr<SalYieldMutex> pMutex );
virtual ~SvpSalInstance() override;
void CloseWakeupPipe(bool log);
......
......@@ -54,7 +54,7 @@ Q_SIGNALS:
bool ImplYieldSignal(bool bWait, bool bHandleAllCurrentEvents);
public:
explicit Qt5Instance(SalYieldMutex* pMutex, bool bUseCairo = false);
explicit Qt5Instance(std::unique_ptr<SalYieldMutex> pMutex, bool bUseCairo = false);
virtual ~Qt5Instance() override;
virtual SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override;
......
......@@ -47,8 +47,8 @@ protected:
std::unique_ptr<SalYieldMutex> mpSalYieldMutex;
public:
SalGenericInstance( SalYieldMutex* pMutex )
: mbPrinterInit( false ), mpSalYieldMutex( pMutex ) {}
SalGenericInstance( std::unique_ptr<SalYieldMutex> pMutex )
: mbPrinterInit( false ), mpSalYieldMutex( std::move(pMutex) ) {}
virtual ~SalGenericInstance() override;
// Yield mutex
......
......@@ -184,7 +184,7 @@ class GtkInstance : public X11SalInstance
typedef X11SalInstance Superclass_t;
#endif
public:
GtkInstance( SalYieldMutex* pMutex );
GtkInstance( std::unique_ptr<SalYieldMutex> pMutex );
virtual ~GtkInstance() override;
void EnsureInit();
virtual void AfterAppInit() override;
......
......@@ -47,7 +47,7 @@ protected:
virtual SalX11Display* CreateDisplay() const;
public:
explicit X11SalInstance(SalYieldMutex* pMutex);
explicit X11SalInstance(std::unique_ptr<SalYieldMutex> pMutex);
virtual ~X11SalInstance() override;
virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override;
......
......@@ -43,8 +43,8 @@
#include <headless/svpbmp.hxx>
Qt5Instance::Qt5Instance(SalYieldMutex* pMutex, bool bUseCairo)
: SalGenericInstance(pMutex)
Qt5Instance::Qt5Instance(std::unique_ptr<SalYieldMutex> pMutex, bool bUseCairo)
: SalGenericInstance(std::move(pMutex))
, m_postUserEventId(-1)
, m_bUseCairo(bUseCairo)
{
......@@ -287,7 +287,7 @@ VCLPLUG_QT5_PUBLIC SalInstance* create_SalInstance()
QApplication::setQuitOnLastWindowClosed(false);
static const bool bUseCairo = (nullptr != getenv("SAL_VCL_QT5_USE_CAIRO"));
Qt5Instance* pInstance = new Qt5Instance(new SalYieldMutex(), bUseCairo);
Qt5Instance* pInstance = new Qt5Instance(o3tl::make_unique<SalYieldMutex>(), bUseCairo);
// initialize SalData
new Qt5Data(pInstance);
......
......@@ -54,7 +54,7 @@ extern "C"
if( ! ( pNoXInitThreads && *pNoXInitThreads ) )
XInitThreads();
X11SalInstance* pInstance = new X11SalInstance( new SalYieldMutex() );
X11SalInstance* pInstance = new X11SalInstance( o3tl::make_unique<SalYieldMutex>() );
// initialize SalData
X11SalData *pSalData = new X11SalData( SAL_DATA_UNX, pInstance );
......@@ -66,8 +66,8 @@ extern "C"
}
}
X11SalInstance::X11SalInstance(SalYieldMutex* pMutex)
: SalGenericInstance(pMutex)
X11SalInstance::X11SalInstance(std::unique_ptr<SalYieldMutex> pMutex)
: SalGenericInstance(std::move(pMutex))
, mpXLib(nullptr)
{
ImplSVData* pSVData = ImplGetSVData();
......
......@@ -91,8 +91,6 @@ extern "C"
}
#endif
GtkYieldMutex *pYieldMutex;
// init gdk thread protection
bool const sup = g_thread_supported();
// extracted from the 'if' to avoid Clang -Wunreachable-code
......@@ -102,11 +100,11 @@ extern "C"
gdk_threads_set_lock_functions (GdkThreadsEnter, GdkThreadsLeave);
SAL_INFO("vcl.gtk", "Hooked gdk threads locks");
pYieldMutex = new GtkYieldMutex();
auto pYieldMutex = o3tl::make_unique<GtkYieldMutex>();
gdk_threads_init();
GtkInstance* pInstance = new GtkInstance( pYieldMutex );
GtkInstance* pInstance = new GtkInstance( std::move(pYieldMutex) );
SAL_INFO("vcl.gtk", "creating GtkInstance " << pInstance);
// Create SalData, this does not leak
......@@ -147,11 +145,11 @@ static VclInputFlags categorizeEvent(const GdkEvent *pEvent)
}
#endif
GtkInstance::GtkInstance( SalYieldMutex* pMutex )
GtkInstance::GtkInstance( std::unique_ptr<SalYieldMutex> pMutex )
#if GTK_CHECK_VERSION(3,0,0)
: SvpSalInstance( pMutex )
: SvpSalInstance( std::move(pMutex) )
#else
: X11SalInstance( pMutex )
: X11SalInstance( std::move(pMutex) )
#endif
, m_pTimer(nullptr)
, bNeedsInit(true)
......
......@@ -31,8 +31,8 @@
using namespace com::sun::star;
KDESalInstance::KDESalInstance(SalYieldMutex* pMutex)
: X11SalInstance(pMutex)
KDESalInstance::KDESalInstance(std::unique_ptr<SalYieldMutex> pMutex)
: X11SalInstance(std::move(pMutex))
{
ImplSVData* pSVData = ImplGetSVData();
delete pSVData->maAppData.mpToolkitName;
......
......@@ -30,7 +30,7 @@ protected:
virtual SalX11Display* CreateDisplay() const override;
public:
explicit KDESalInstance(SalYieldMutex* pMutex);
explicit KDESalInstance(std::unique_ptr<SalYieldMutex> pMutex);
virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
virtual bool hasNativeFileSelection() const override { return true; }
......
......@@ -73,7 +73,7 @@ extern "C" {
}
#endif
KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() );
KDESalInstance* pInstance = new KDESalInstance( o3tl::make_unique<SalYieldMutex>() );
SAL_INFO( "vcl.kde4", "created KDESalInstance " << &pInstance );
// initialize SalData
......
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