Avoid unncessary, premature null deref
...when SfxTabPage::Reset (sfx2/source/dialog/tabdlg.cxx) calls into DoApplyFlags/DoRest with a null rSet (but which apparently isn't actually used then), e.g. upon "File - Export as PDF..." in Impress. Change-Id: Ie2f255694212356fa8fc994287c45f2b4730a5bd
This commit is contained in:
@@ -184,9 +184,9 @@ public:
|
||||
bool IsActive() const;
|
||||
|
||||
/** Calls the virtual ApplyFlags() function, if connection is active. */
|
||||
void DoApplyFlags( const SfxItemSet& rItemSet );
|
||||
void DoApplyFlags( const SfxItemSet* pItemSet );
|
||||
/** Calls the virtual Reset() function, if connection is active. */
|
||||
void DoReset( const SfxItemSet& rItemSet );
|
||||
void DoReset( const SfxItemSet* pItemSet );
|
||||
/** Calls the virtual FillItemSet() function, if connection is active. */
|
||||
bool DoFillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet );
|
||||
|
||||
@@ -194,9 +194,9 @@ protected:
|
||||
explicit ItemConnectionBase( ItemConnFlags nFlags = ITEMCONN_DEFAULT );
|
||||
|
||||
/** Derived classes implement actions according to current flags here. */
|
||||
virtual void ApplyFlags( const SfxItemSet& rItemSet ) = 0;
|
||||
virtual void ApplyFlags( const SfxItemSet* pItemSet ) = 0;
|
||||
/** Derived classes implement initializing controls from item sets here. */
|
||||
virtual void Reset( const SfxItemSet& rItemSet ) = 0;
|
||||
virtual void Reset( const SfxItemSet* pItemSet ) = 0;
|
||||
/** Derived classes implement filling item sets from controls here. */
|
||||
virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) = 0;
|
||||
|
||||
@@ -252,9 +252,9 @@ public:
|
||||
|
||||
protected:
|
||||
/** Actions according to current flags for the control. */
|
||||
virtual void ApplyFlags( const SfxItemSet& rItemSet ) override;
|
||||
virtual void ApplyFlags( const SfxItemSet* pItemSet ) override;
|
||||
/** Resets the control according to the item contents. */
|
||||
virtual void Reset( const SfxItemSet& rItemSet ) override;
|
||||
virtual void Reset( const SfxItemSet* pItemSet ) override;
|
||||
/** Fills the item set according to the control's state. */
|
||||
virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) override;
|
||||
|
||||
@@ -281,8 +281,8 @@ public:
|
||||
ItemConnFlags nFlags = ITEMCONN_DEFAULT );
|
||||
|
||||
protected:
|
||||
virtual void ApplyFlags( const SfxItemSet& rItemSet ) override;
|
||||
virtual void Reset( const SfxItemSet& rItemSet ) override;
|
||||
virtual void ApplyFlags( const SfxItemSet* pItemSet ) override;
|
||||
virtual void Reset( const SfxItemSet* pItemSet ) override;
|
||||
virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) override;
|
||||
|
||||
private:
|
||||
@@ -421,8 +421,8 @@ public:
|
||||
void AddConnection( ItemConnectionBase* pConnection );
|
||||
|
||||
protected:
|
||||
virtual void ApplyFlags( const SfxItemSet& rItemSet ) override;
|
||||
virtual void Reset( const SfxItemSet& rItemSet ) override;
|
||||
virtual void ApplyFlags( const SfxItemSet* pItemSet ) override;
|
||||
virtual void Reset( const SfxItemSet* pItemSet ) override;
|
||||
virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) override;
|
||||
|
||||
private:
|
||||
@@ -463,16 +463,16 @@ ItemControlConnection< ItemWrpT, ControlWrpT >::~ItemControlConnection()
|
||||
}
|
||||
|
||||
template< typename ItemWrpT, typename ControlWrpT >
|
||||
void ItemControlConnection< ItemWrpT, ControlWrpT >::ApplyFlags( const SfxItemSet& rItemSet )
|
||||
void ItemControlConnection< ItemWrpT, ControlWrpT >::ApplyFlags( const SfxItemSet* pItemSet )
|
||||
{
|
||||
bool bKnown = ItemWrapperHelper::IsKnownItem( rItemSet, maItemWrp.GetSlotId() );
|
||||
bool bKnown = ItemWrapperHelper::IsKnownItem( *pItemSet, maItemWrp.GetSlotId() );
|
||||
mxCtrlWrp->ModifyControl( GetEnableState( bKnown ), GetShowState( bKnown ) );
|
||||
}
|
||||
|
||||
template< typename ItemWrpT, typename ControlWrpT >
|
||||
void ItemControlConnection< ItemWrpT, ControlWrpT >::Reset( const SfxItemSet& rItemSet )
|
||||
void ItemControlConnection< ItemWrpT, ControlWrpT >::Reset( const SfxItemSet* pItemSet )
|
||||
{
|
||||
const ItemType* pItem = maItemWrp.GetUniqueItem( rItemSet );
|
||||
const ItemType* pItem = maItemWrp.GetUniqueItem( *pItemSet );
|
||||
mxCtrlWrp->SetControlDontKnow( pItem == nullptr );
|
||||
if( pItem )
|
||||
mxCtrlWrp->SetControlValue( maItemWrp.GetItemValue( *pItem ) );
|
||||
|
@@ -222,16 +222,16 @@ bool ItemConnectionBase::IsActive() const
|
||||
return !(mnFlags & ITEMCONN_INACTIVE);
|
||||
}
|
||||
|
||||
void ItemConnectionBase::DoApplyFlags( const SfxItemSet& rItemSet )
|
||||
void ItemConnectionBase::DoApplyFlags( const SfxItemSet* pItemSet )
|
||||
{
|
||||
if( IsActive() )
|
||||
ApplyFlags( rItemSet );
|
||||
ApplyFlags( pItemSet );
|
||||
}
|
||||
|
||||
void ItemConnectionBase::DoReset( const SfxItemSet& rItemSet )
|
||||
void ItemConnectionBase::DoReset( const SfxItemSet* pItemSet )
|
||||
{
|
||||
if( IsActive() )
|
||||
Reset( rItemSet );
|
||||
Reset( pItemSet );
|
||||
}
|
||||
|
||||
bool ItemConnectionBase::DoFillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet )
|
||||
@@ -260,13 +260,13 @@ DummyItemConnection::DummyItemConnection( sal_uInt16 nSlot, vcl::Window& rWindow
|
||||
{
|
||||
}
|
||||
|
||||
void DummyItemConnection::ApplyFlags( const SfxItemSet& rItemSet )
|
||||
void DummyItemConnection::ApplyFlags( const SfxItemSet* pItemSet )
|
||||
{
|
||||
bool bKnown = ItemWrapperHelper::IsKnownItem( rItemSet, mnSlot );
|
||||
bool bKnown = ItemWrapperHelper::IsKnownItem( *pItemSet, mnSlot );
|
||||
ModifyControl( GetEnableState( bKnown ), GetShowState( bKnown ) );
|
||||
}
|
||||
|
||||
void DummyItemConnection::Reset( const SfxItemSet& /*rItemSet*/ )
|
||||
void DummyItemConnection::Reset( const SfxItemSet* )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -284,8 +284,8 @@ class ItemConnectionArrayImpl
|
||||
public:
|
||||
void Append( ItemConnectionBase* pConnection );
|
||||
|
||||
void ApplyFlags( const SfxItemSet& rItemSet );
|
||||
void Reset( const SfxItemSet& rItemSet );
|
||||
void ApplyFlags( const SfxItemSet* pItemSet );
|
||||
void Reset( const SfxItemSet* pItemSet );
|
||||
bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet );
|
||||
|
||||
private:
|
||||
@@ -302,16 +302,16 @@ void ItemConnectionArrayImpl::Append( ItemConnectionBase* pConnection )
|
||||
maList.push_back( ItemConnectionRef( pConnection ) );
|
||||
}
|
||||
|
||||
void ItemConnectionArrayImpl::ApplyFlags( const SfxItemSet& rItemSet )
|
||||
void ItemConnectionArrayImpl::ApplyFlags( const SfxItemSet* pItemSet )
|
||||
{
|
||||
for( ItemConnectionListIt aIt = maList.begin(), aEnd = maList.end(); aIt != aEnd; ++aIt )
|
||||
(*aIt)->DoApplyFlags( rItemSet );
|
||||
(*aIt)->DoApplyFlags( pItemSet );
|
||||
}
|
||||
|
||||
void ItemConnectionArrayImpl::Reset( const SfxItemSet& rItemSet )
|
||||
void ItemConnectionArrayImpl::Reset( const SfxItemSet* pItemSet )
|
||||
{
|
||||
for( ItemConnectionListIt aIt = maList.begin(), aEnd = maList.end(); aIt != aEnd; ++aIt )
|
||||
(*aIt)->DoReset( rItemSet );
|
||||
(*aIt)->DoReset( pItemSet );
|
||||
}
|
||||
|
||||
bool ItemConnectionArrayImpl::FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet )
|
||||
@@ -338,14 +338,14 @@ void ItemConnectionArray::AddConnection( ItemConnectionBase* pConnection )
|
||||
mxImpl->Append( pConnection );
|
||||
}
|
||||
|
||||
void ItemConnectionArray::ApplyFlags( const SfxItemSet& rItemSet )
|
||||
void ItemConnectionArray::ApplyFlags( const SfxItemSet* pItemSet )
|
||||
{
|
||||
mxImpl->ApplyFlags( rItemSet );
|
||||
mxImpl->ApplyFlags( pItemSet );
|
||||
}
|
||||
|
||||
void ItemConnectionArray::Reset( const SfxItemSet& rItemSet )
|
||||
void ItemConnectionArray::Reset( const SfxItemSet* pItemSet )
|
||||
{
|
||||
mxImpl->Reset( rItemSet );
|
||||
mxImpl->Reset( pItemSet );
|
||||
}
|
||||
|
||||
bool ItemConnectionArray::FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet )
|
||||
|
@@ -188,8 +188,8 @@ bool SfxTabPage::FillItemSet( SfxItemSet* rSet )
|
||||
|
||||
void SfxTabPage::Reset( const SfxItemSet* rSet )
|
||||
{
|
||||
pImpl->maItemConn.DoApplyFlags( *rSet );
|
||||
pImpl->maItemConn.DoReset( *rSet );
|
||||
pImpl->maItemConn.DoApplyFlags( rSet );
|
||||
pImpl->maItemConn.DoReset( rSet );
|
||||
}
|
||||
|
||||
void SfxTabPage::ActivatePage( const SfxItemSet& )
|
||||
|
Reference in New Issue
Block a user