[Libreoffice-commits] core.git: 3 commits - sw/inc sw/source
Bjoern Michaelsen
bjoern.michaelsen at canonical.com
Fri Dec 5 11:13:30 PST 2014
sw/inc/calbck.hxx | 8 -------
sw/inc/ring.hxx | 17 +++++++++++++++
sw/source/core/attr/calbck.cxx | 34 ++++++++++++++-----------------
sw/source/core/unocore/unotextmarkup.cxx | 4 ---
4 files changed, 34 insertions(+), 29 deletions(-)
New commits:
commit 526e746c3a95ee1dfbdf222e61d28ccc5be3cc98
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Fri Dec 5 20:07:27 2014 +0100
ugly preliminary hack for keeping ggc 4.6 happy
Change-Id: I41d605b5acbb54969d6b2cb68f06583983ee0d4b
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index 913d62a..b751733 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -27,6 +27,13 @@
#include <boost/iterator/iterator_facade.hpp>
#include <boost/intrusive/circular_list_algorithms.hpp>
+#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 7)
+// gcc 4.6 backwards compat hack, remove ASAP when we drop support
+class SwPaM;
+class SwViewShell;
+class _SaveMergeRedlines;
+#endif
+
namespace sw
{
template <typename value_type> class RingContainer;
@@ -101,8 +108,18 @@ namespace sw
static node_ptr get_previous(const_node_ptr n) { return const_cast<node_ptr>(static_cast<const_node_ptr>(n))->GetPrevInRing(); };
static void set_previous(node_ptr n, node_ptr previous) { n->pPrev = previous; };
};
+#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 7)
+ // gcc 4.6 backwards compat hack, remove ASAP when we drop support
+ friend class sw::RingContainer<SwPaM>;
+ friend class sw::RingContainer<const SwPaM>;
+ friend class sw::RingContainer<SwViewShell>;
+ friend class sw::RingContainer<const SwViewShell>;
+ friend class sw::RingContainer<_SaveMergeRedlines>;
+ friend class sw::RingContainer<const _SaveMergeRedlines>;
+#else
friend ring_container;
friend const_ring_container;
+#endif
friend typename ring_container::iterator;
friend typename ring_container::const_iterator;
friend typename const_ring_container::iterator;
commit 6cd053ebf2289fda4c5abd523db493d570ebb1c3
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Fri Dec 5 17:51:56 2014 +0100
since touching this: sprinkle in some nullptr
Change-Id: I8a229e020acddfda2e7c69fc7faf24d1c338c879
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index a1193f7..a06bba2 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -23,12 +23,12 @@
#include <swcache.hxx>
#include <swfntcch.hxx>
-static SwClientIter* pClientIters = 0;
+static SwClientIter* pClientIters = nullptr;
TYPEINIT0( SwClient );
SwClient::SwClient( SwModify* pToRegisterIn )
- : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 )
+ : pLeft( nullptr ), pRight( nullptr ), pRegisteredIn( nullptr )
{
if(pToRegisterIn)
// connect to SwModify
@@ -81,7 +81,7 @@ bool SwClient::GetInfo( SfxPoolItem& ) const
}
SwModify::SwModify()
- : SwClient(0), pRoot(0)
+ : SwClient(nullptr), pRoot(nullptr)
{
bModifyLocked = false;
bLockClientList = false;
@@ -91,7 +91,7 @@ SwModify::SwModify()
}
SwModify::SwModify( SwModify* pToRegisterIn )
- : SwClient( pToRegisterIn ), pRoot( 0 )
+ : SwClient( pToRegisterIn ), pRoot( nullptr )
{
bModifyLocked = false;
bLockClientList = false;
@@ -122,7 +122,7 @@ SwModify::~SwModify()
SwClient* p = aIter.GoStart();
while ( p )
{
- p->pRegisteredIn = 0;
+ p->pRegisteredIn = nullptr;
p = ++aIter;
}
}
@@ -195,7 +195,7 @@ bool SwModify::GetInfo( SfxPoolItem& rInfo ) const
if( pLast )
{
while( ( bRet = pLast->GetInfo( rInfo ) ) &&
- 0 != ( pLast = ++aIter ) )
+ nullptr != ( pLast = ++aIter ) )
;
}
}
@@ -218,15 +218,15 @@ void SwModify::Add( SwClient* pDepend )
}
#endif
// deregister new client in case it is already registered elsewhere
- if( pDepend->pRegisteredIn != 0 )
+ if( pDepend->pRegisteredIn != nullptr )
pDepend->pRegisteredIn->Remove( pDepend );
if( !pRoot )
{
// first client added
pRoot = pDepend;
- pRoot->pLeft = 0;
- pRoot->pRight = 0;
+ pRoot->pLeft = nullptr;
+ pRoot->pRight = nullptr;
}
else
{
@@ -246,7 +246,7 @@ void SwModify::Add( SwClient* pDepend )
SwClient* SwModify::Remove( SwClient* pDepend )
{
if ( bInDocDTOR )
- return 0;
+ return nullptr;
if( pDepend->pRegisteredIn == this )
{
@@ -275,8 +275,8 @@ SwClient* SwModify::Remove( SwClient* pDepend )
pTmp = pTmp->pNxtIter;
}
- pDepend->pLeft = 0;
- pDepend->pRight = 0;
+ pDepend->pLeft = nullptr;
+ pDepend->pRight = nullptr;
}
else
{
@@ -284,7 +284,7 @@ SwClient* SwModify::Remove( SwClient* pDepend )
}
// disconnect client from me
- pDepend->pRegisteredIn = 0;
+ pDepend->pRegisteredIn = nullptr;
return pDepend;
}
@@ -369,8 +369,8 @@ bool SwDepend::GetInfo( SfxPoolItem& rInfo ) const
SwClientIter::SwClientIter( const SwModify& rModify )
: rRoot(rModify)
- , pNxtIter(NULL)
- , aSrchId(0)
+ , pNxtIter(nullptr)
+ , aSrchId(nullptr)
{
if( pClientIters )
{
@@ -398,7 +398,7 @@ SwClientIter::~SwClientIter()
{
SwClientIter* pTmp = pClientIters;
while( pTmp->pNxtIter != this )
- if( 0 == ( pTmp = pTmp->pNxtIter ) )
+ if( nullptr == ( pTmp = pTmp->pNxtIter ) )
{
OSL_ENSURE( this, "Lost my pointer" );
return ;
commit 7c1b420c0f094eee1020806a75f4baa48c3d5d2b
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Fri Dec 5 17:45:58 2014 +0100
removing in callback should be alright, we update the iterators
Change-Id: Iefaee20a603fa3f43a58107ea54e6e3f7a4d344f
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 3f6ca20..68fa315 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -67,11 +67,6 @@ class SW_DLLPUBLIC SwClient : ::boost::noncopyable
SwClient *pLeft, *pRight; ///< double-linked list of other clients
SwModify *pRegisteredIn; ///< event source
- // in general clients should not be removed when their SwModify sends out Modify()
- // notifications; in some rare cases this is necessary, but only the concrete SwClient
- // sub class will know that; this flag allows to make that known
- bool mbIsAllowedToBeRemovedInModifyCall;
-
// callbacks received from SwModify (friend class - so these methods can be private)
// should be called only from SwModify the client is registered in
// mba: IMHO these methods should be pure virtual
@@ -84,7 +79,6 @@ protected:
// write access to pRegisteredIn shall be granted only to the object itself (protected access)
SwModify* GetRegisteredInNonConst() const { return pRegisteredIn; }
- void SetIsAllowedToBeRemovedInModifyCall( bool bSet ) { mbIsAllowedToBeRemovedInModifyCall = bSet; }
public:
@@ -112,7 +106,7 @@ public:
};
inline SwClient::SwClient() :
- pLeft(0), pRight(0), pRegisteredIn(0), mbIsAllowedToBeRemovedInModifyCall(false)
+ pLeft(0), pRight(0), pRegisteredIn(0)
{}
// SwModify
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 548c27c..a1193f7 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -28,7 +28,7 @@ static SwClientIter* pClientIters = 0;
TYPEINIT0( SwClient );
SwClient::SwClient( SwModify* pToRegisterIn )
- : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 ), mbIsAllowedToBeRemovedInModifyCall( false )
+ : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 )
{
if(pToRegisterIn)
// connect to SwModify
@@ -248,8 +248,6 @@ SwClient* SwModify::Remove( SwClient* pDepend )
if ( bInDocDTOR )
return 0;
- OSL_ENSURE( !bLockClientList || pDepend->mbIsAllowedToBeRemovedInModifyCall, "SwClient shall be removed in Modify call!" );
-
if( pDepend->pRegisteredIn == this )
{
// SwClient is my listener
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index 860415d..bc1cceb 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -45,8 +45,6 @@ SwXTextMarkup::SwXTextMarkup(
: mpTxtNode(pTxtNode)
, maConversionMap(rMap)
{
- // FME 2007-07-16 #i79641# SwXTextMarkup is allowed to be removed ...
- SetIsAllowedToBeRemovedInModifyCall(true);
mpTxtNode->Add(this);
}
@@ -451,8 +449,6 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
void SwXTextMarkup::Modify( const SfxPoolItem* /*pOld*/, const SfxPoolItem* /*pNew*/ )
{
- // FME 2007-07-16 #i79641# In my opinion this is perfectly legal,
- // therefore I remove the assertion in SwModify::_Remove()
if ( GetRegisteredIn() )
GetRegisteredInNonConst()->Remove( this );
More information about the Libreoffice-commits
mailing list