Kaydet (Commit) a44e03b5 authored tarafından Dennis Francis's avatar Dennis Francis Kaydeden (comit) Caolán McNamara

memleak:clear self referring VclPtr in *Field and *Box classes

Clears self referring VclPtr called mpField via FormatterBase in :

1. MetricField, PatternField, NumericField, CurrencyField, DateField,
   TimeField
2. PatternBox, NumericBox, CurrencyBox, DateBox, TimeBox

via respective dispose() methods.

Change-Id: I7f92fefd49756cabe7db7d240781260a2d4cd298
Reviewed-on: https://gerrit.libreoffice.org/18701Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 92c8d74c
...@@ -476,6 +476,7 @@ public: ...@@ -476,6 +476,7 @@ public:
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual void Modify() SAL_OVERRIDE; virtual void Modify() SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -505,6 +506,7 @@ public: ...@@ -505,6 +506,7 @@ public:
virtual void First() SAL_OVERRIDE; virtual void First() SAL_OVERRIDE;
virtual void Last() SAL_OVERRIDE; virtual void Last() SAL_OVERRIDE;
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -575,6 +577,7 @@ public: ...@@ -575,6 +577,7 @@ public:
{ return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); } { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -597,6 +600,7 @@ public: ...@@ -597,6 +600,7 @@ public:
virtual void Down() SAL_OVERRIDE; virtual void Down() SAL_OVERRIDE;
virtual void First() SAL_OVERRIDE; virtual void First() SAL_OVERRIDE;
virtual void Last() SAL_OVERRIDE; virtual void Last() SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -631,6 +635,7 @@ public: ...@@ -631,6 +635,7 @@ public:
Date GetFirst() const { return maFirst; } Date GetFirst() const { return maFirst; }
void SetLast( const Date& rNewLast ) { maLast = rNewLast; } void SetLast( const Date& rNewLast ) { maLast = rNewLast; }
Date GetLast() const { return maLast; } Date GetLast() const { return maLast; }
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -666,6 +671,7 @@ public: ...@@ -666,6 +671,7 @@ public:
tools::Time GetLast() const { return maLast; } tools::Time GetLast() const { return maLast; }
void SetExtFormat( ExtTimeFieldFormat eFormat ); void SetExtFormat( ExtTimeFieldFormat eFormat );
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -684,6 +690,7 @@ public: ...@@ -684,6 +690,7 @@ public:
virtual void Modify() SAL_OVERRIDE; virtual void Modify() SAL_OVERRIDE;
virtual void ReformatAll() SAL_OVERRIDE; virtual void ReformatAll() SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -707,6 +714,7 @@ public: ...@@ -707,6 +714,7 @@ public:
virtual void ReformatAll() SAL_OVERRIDE; virtual void ReformatAll() SAL_OVERRIDE;
void InsertValue( sal_Int64 nValue, sal_Int32 nPos = COMBOBOX_APPEND ); void InsertValue( sal_Int64 nValue, sal_Int32 nPos = COMBOBOX_APPEND );
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -762,6 +770,7 @@ public: ...@@ -762,6 +770,7 @@ public:
virtual void ReformatAll() SAL_OVERRIDE; virtual void ReformatAll() SAL_OVERRIDE;
virtual sal_Int64 GetValue() const SAL_OVERRIDE; virtual sal_Int64 GetValue() const SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -780,6 +789,7 @@ public: ...@@ -780,6 +789,7 @@ public:
virtual void Modify() SAL_OVERRIDE; virtual void Modify() SAL_OVERRIDE;
virtual void ReformatAll() SAL_OVERRIDE; virtual void ReformatAll() SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
...@@ -799,6 +809,7 @@ public: ...@@ -799,6 +809,7 @@ public:
virtual void Modify() SAL_OVERRIDE; virtual void Modify() SAL_OVERRIDE;
virtual void ReformatAll() SAL_OVERRIDE; virtual void ReformatAll() SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
}; };
#endif // INCLUDED_VCL_FIELD_HXX #endif // INCLUDED_VCL_FIELD_HXX
......
...@@ -800,6 +800,12 @@ NumericField::NumericField( vcl::Window* pParent, const ResId& rResId ) : ...@@ -800,6 +800,12 @@ NumericField::NumericField( vcl::Window* pParent, const ResId& rResId ) :
Show(); Show();
} }
void NumericField::dispose()
{
NumericFormatter::SetField( NULL );
SpinField::dispose();
}
bool NumericField::set_property(const OString &rKey, const OString &rValue) bool NumericField::set_property(const OString &rKey, const OString &rValue)
{ {
if (rKey == "digits") if (rKey == "digits")
...@@ -949,6 +955,12 @@ NumericBox::NumericBox( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -949,6 +955,12 @@ NumericBox::NumericBox( vcl::Window* pParent, WinBits nWinStyle ) :
Show(); Show();
} }
void NumericBox::dispose()
{
NumericFormatter::SetField( NULL );
ComboBox::dispose();
}
Size NumericBox::CalcMinimumSize() const Size NumericBox::CalcMinimumSize() const
{ {
Size aRet(calcMinimumSize(*this, *this)); Size aRet(calcMinimumSize(*this, *this));
...@@ -1612,6 +1624,12 @@ MetricField::MetricField( vcl::Window* pParent, const ResId& rResId ) : ...@@ -1612,6 +1624,12 @@ MetricField::MetricField( vcl::Window* pParent, const ResId& rResId ) :
Show(); Show();
} }
void MetricField::dispose()
{
MetricFormatter::SetField( NULL );
SpinField::dispose();
}
Size MetricField::CalcMinimumSize() const Size MetricField::CalcMinimumSize() const
{ {
return calcMinimumSize(*this, *this); return calcMinimumSize(*this, *this);
...@@ -2010,6 +2028,12 @@ CurrencyField::CurrencyField( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -2010,6 +2028,12 @@ CurrencyField::CurrencyField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat(); Reformat();
} }
void CurrencyField::dispose()
{
CurrencyFormatter::SetField( NULL );
SpinField::dispose();
}
bool CurrencyField::PreNotify( NotifyEvent& rNEvt ) bool CurrencyField::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
...@@ -2088,6 +2112,12 @@ CurrencyBox::CurrencyBox( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -2088,6 +2112,12 @@ CurrencyBox::CurrencyBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat(); Reformat();
} }
void CurrencyBox::dispose()
{
CurrencyFormatter::SetField( NULL );
ComboBox::dispose();
}
bool CurrencyBox::PreNotify( NotifyEvent& rNEvt ) bool CurrencyBox::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
......
...@@ -819,6 +819,12 @@ PatternField::PatternField( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -819,6 +819,12 @@ PatternField::PatternField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat(); Reformat();
} }
void PatternField::dispose()
{
PatternFormatter::SetField( NULL );
SpinField::dispose();
}
bool PatternField::PreNotify( NotifyEvent& rNEvt ) bool PatternField::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
...@@ -865,6 +871,12 @@ PatternBox::PatternBox( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -865,6 +871,12 @@ PatternBox::PatternBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat(); Reformat();
} }
void PatternBox::dispose()
{
PatternFormatter::SetField( NULL );
ComboBox::dispose();
}
bool PatternBox::PreNotify( NotifyEvent& rNEvt ) bool PatternBox::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
...@@ -1716,6 +1728,12 @@ DateField::DateField( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -1716,6 +1728,12 @@ DateField::DateField( vcl::Window* pParent, WinBits nWinStyle ) :
ResetLastDate(); ResetLastDate();
} }
void DateField::dispose()
{
DateFormatter::SetField( NULL );
SpinField::dispose();
}
bool DateField::PreNotify( NotifyEvent& rNEvt ) bool DateField::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() && if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() &&
...@@ -1815,6 +1833,12 @@ DateBox::DateBox( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -1815,6 +1833,12 @@ DateBox::DateBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat(); Reformat();
} }
void DateBox::dispose()
{
DateFormatter::SetField( NULL );
ComboBox::dispose();
}
bool DateBox::PreNotify( NotifyEvent& rNEvt ) bool DateBox::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() && if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() &&
...@@ -2489,6 +2513,12 @@ TimeField::TimeField( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -2489,6 +2513,12 @@ TimeField::TimeField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat(); Reformat();
} }
void TimeField::dispose()
{
TimeFormatter::SetField( NULL );
SpinField::dispose();
}
bool TimeField::PreNotify( NotifyEvent& rNEvt ) bool TimeField::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
...@@ -2626,6 +2656,12 @@ TimeBox::TimeBox( vcl::Window* pParent, WinBits nWinStyle ) : ...@@ -2626,6 +2656,12 @@ TimeBox::TimeBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat(); Reformat();
} }
void TimeBox::dispose()
{
TimeFormatter::SetField( NULL );
ComboBox::dispose();
}
bool TimeBox::PreNotify( NotifyEvent& rNEvt ) bool TimeBox::PreNotify( NotifyEvent& rNEvt )
{ {
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
......
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