summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-07-01 23:46:44 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-07-17 16:40:22 +0200
commit17c549221427bde2390368be39f48134409a933f (patch)
tree4135e2ba349ae7aeffd3fae6dcf27a84bce7f3f2
parentinclude tubes/warnings_guard_boost_signals2.hpp [-Werror=shadow] (diff)
downloadcore-17c549221427bde2390368be39f48134409a933f.tar.gz
core-17c549221427bde2390368be39f48134409a933f.zip
tubes: reduce the use of boost::shared_ptr
Change-Id: Iafb38cf635ac8a967e5a94965f537fe0fa021f87
-rw-r--r--sc/source/ui/collab/contacts.cxx5
-rw-r--r--sc/source/ui/collab/sendfunc.cxx26
-rw-r--r--sc/source/ui/collab/sendfunc.hxx14
3 files changed, 28 insertions, 17 deletions
diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx
index 078bcdd4c3ec..f15c9e0f63b1 100644
--- a/sc/source/ui/collab/contacts.cxx
+++ b/sc/source/ui/collab/contacts.cxx
@@ -70,9 +70,8 @@ class TubeContacts : public ModelessDialog
ScDocFuncSend *pSender = dynamic_cast<ScDocFuncSend*> (pDocFunc);
if (!pSender)
{
- delete pDocFunc;
- boost::shared_ptr<ScDocFuncDirect> pDirect( new ScDocFuncDirect( *pScDocShell ) );
- boost::shared_ptr<ScDocFuncRecv> pReceiver( new ScDocFuncRecv( pDirect ) );
+ ScDocFuncDirect *pDirect = dynamic_cast<ScDocFuncDirect*> (pDocFunc);
+ ScDocFuncRecv *pReceiver = new ScDocFuncRecv( pDirect );
pSender = new ScDocFuncSend( *pScDocShell, pReceiver );
pScDocShell->SetDocFunc( pSender );
}
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index b6068ad7e27d..256a9ae972ce 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -73,12 +73,18 @@ bool isCollabMode( bool& rbMaster )
}
// FIXME: really ScDocFunc should be an abstract base
-ScDocFuncRecv::ScDocFuncRecv( boost::shared_ptr<ScDocFuncDirect>& pChain )
+ScDocFuncRecv::ScDocFuncRecv( ScDocFuncDirect *pChain )
: mpChain( pChain )
{
fprintf( stderr, "Receiver created !\n" );
}
+ScDocFuncRecv::~ScDocFuncRecv()
+{
+ fprintf( stderr, "Receiver destroyed !\n" );
+ delete mpChain;
+}
+
void ScDocFuncRecv::RecvMessage( const rtl::OString &rString )
{
try {
@@ -274,7 +280,7 @@ void ScDocFuncSend::SendFile( const rtl::OUString &rURL )
// FIXME: really ScDocFunc should be an abstract base, so
// we don't need the rDocSh hack/pointer
-ScDocFuncSend::ScDocFuncSend( ScDocShell& rDocSh, boost::shared_ptr<ScDocFuncRecv> pDirect )
+ScDocFuncSend::ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncRecv *pDirect )
: ScDocFunc( rDocSh ),
mpDirect( pDirect ),
mpManager( NULL )
@@ -282,6 +288,12 @@ ScDocFuncSend::ScDocFuncSend( ScDocShell& rDocSh, boost::shared_ptr<ScDocFuncRec
fprintf( stderr, "Sender created !\n" );
}
+ScDocFuncSend::~ScDocFuncSend()
+{
+ fprintf( stderr, "Sender destroyed !\n" );
+ delete mpDirect;
+}
+
bool ScDocFuncSend::InitTeleManager( bool bIsMaster )
{
if (mpManager)
@@ -291,9 +303,9 @@ bool ScDocFuncSend::InitTeleManager( bool bIsMaster )
}
TeleManager *pManager = TeleManager::get( !bIsMaster );
pManager->sigPacketReceived.connect( boost::bind(
- &ScDocFuncRecv::packetReceived, mpDirect.get(), _1, _2 ));
+ &ScDocFuncRecv::packetReceived, mpDirect, _1, _2 ));
pManager->sigFileReceived.connect( boost::bind(
- &ScDocFuncRecv::fileReceived, mpDirect.get(), _1 ));
+ &ScDocFuncRecv::fileReceived, mpDirect, _1 ));
if (pManager->connect())
{
@@ -438,9 +450,9 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc()
}
else if (isCollabMode( bIsMaster ))
{
- boost::shared_ptr<ScDocFuncDirect> pDirect( new ScDocFuncDirect( *this ) );
- boost::shared_ptr<ScDocFuncRecv> pReceiver( new ScDocFuncRecv( pDirect ) );
- ScDocFuncSend* pSender = new ScDocFuncSend( *this, pReceiver );
+ ScDocFuncDirect *pDirect = new ScDocFuncDirect( *this );
+ ScDocFuncRecv *pReceiver = new ScDocFuncRecv( pDirect );
+ ScDocFuncSend *pSender = new ScDocFuncSend( *this, pReceiver );
pSender->InitTeleManager( bIsMaster );
return pSender;
}
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index 99fde98234ba..1798743c7c57 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -207,15 +207,15 @@ public:
class ScDocFuncRecv
{
- boost::shared_ptr<ScDocFuncDirect> mpChain;
+ ScDocFuncDirect *mpChain;
protected:
ScDocFuncRecv() {}
public:
// FIXME: really ScDocFunc should be an abstract base
- ScDocFuncRecv( boost::shared_ptr<ScDocFuncDirect>& pChain );
- virtual ~ScDocFuncRecv() {}
+ ScDocFuncRecv( ScDocFuncDirect *pChain );
+ virtual ~ScDocFuncRecv();
void packetReceived( TeleConference*, TelePacket &rPacket );
@@ -225,8 +225,8 @@ public:
class ScDocFuncSend : public ScDocFunc
{
- boost::shared_ptr<ScDocFuncRecv> mpDirect;
- TeleManager *mpManager;
+ ScDocFuncRecv *mpDirect;
+ TeleManager *mpManager;
void SendMessage( ScChangeOpWriter &rOp );
void SendFile( const rtl::OUString &rURL );
@@ -234,8 +234,8 @@ class ScDocFuncSend : public ScDocFunc
public:
// FIXME: really ScDocFunc should be an abstract base, so
// we don't need the rDocSh hack/pointer
- ScDocFuncSend( ScDocShell& rDocSh, boost::shared_ptr<ScDocFuncRecv> pDirect );
- virtual ~ScDocFuncSend() {}
+ ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncRecv *pDirect );
+ virtual ~ScDocFuncSend();
bool InitTeleManager( bool bIsMaster );