summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennisfrancis.in@gmail.com>2015-09-18 07:33:27 +0530
committerJan Holesovsky <kendy@collabora.com>2015-10-20 12:35:15 +0000
commitb09dbf6c718ba0b2d920988b510bfd130bc2c3f3 (patch)
treeccf3179f90b75bd2e5ad6ab3d5d6bcb4f771b25a
parentbcbf852f8cb7ebde5f506d53fdcc837d439be475 (diff)
Resolves: tdf#94848 crash on focus with un-cleared but dead mpSubEdit
was... fixes memleak : clear self referring VclPtr in MetricBox Clears self referring VclPtr called mpField in MetricBox (inherited from FormatterBase class) via dispose() method of MetricBox. Reviewed-on: https://gerrit.libreoffice.org/18674 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 36c11cb71c6ec107cc08b16109e468765abc9867) Change-Id: I375e03e814de3c6e47c36b1fc6f625b04521a5e2 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/18701 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit a44e03b5d7822d026a3b2fbaf039522f085defed) Reviewed-on: https://gerrit.libreoffice.org/19398 Reviewed-by: Dennis Francis <dennisfrancis.in@gmail.com> Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--include/vcl/field.hxx13
-rw-r--r--vcl/source/control/field.cxx36
-rw-r--r--vcl/source/control/field2.cxx36
3 files changed, 85 insertions, 0 deletions
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index dc461b781771..8d9236646e6f 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -489,6 +489,7 @@ public:
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual void Modify() SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -518,6 +519,7 @@ public:
virtual void First() SAL_OVERRIDE;
virtual void Last() SAL_OVERRIDE;
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -588,6 +590,7 @@ public:
{ return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -610,6 +613,7 @@ public:
virtual void Down() SAL_OVERRIDE;
virtual void First() SAL_OVERRIDE;
virtual void Last() SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -644,6 +648,7 @@ public:
Date GetFirst() const { return maFirst; }
void SetLast( const Date& rNewLast ) { maLast = rNewLast; }
Date GetLast() const { return maLast; }
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -679,6 +684,7 @@ public:
tools::Time GetLast() const { return maLast; }
void SetExtFormat( ExtTimeFieldFormat eFormat );
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -697,6 +703,7 @@ public:
virtual void Modify() SAL_OVERRIDE;
virtual void ReformatAll() SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -720,6 +727,7 @@ public:
virtual void ReformatAll() SAL_OVERRIDE;
void InsertValue( sal_Int64 nValue, sal_Int32 nPos = COMBOBOX_APPEND );
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -752,6 +760,8 @@ public:
// Needed, because GetValue() with nPos hide these functions
virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const SAL_OVERRIDE;
virtual sal_Int64 GetValue() const SAL_OVERRIDE;
+
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -773,6 +783,7 @@ public:
virtual void ReformatAll() SAL_OVERRIDE;
virtual sal_Int64 GetValue() const SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -791,6 +802,7 @@ public:
virtual void Modify() SAL_OVERRIDE;
virtual void ReformatAll() SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
@@ -810,6 +822,7 @@ public:
virtual void Modify() SAL_OVERRIDE;
virtual void ReformatAll() SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
};
#endif // INCLUDED_VCL_FIELD_HXX
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index cb6b46b8cb7a..4e7bd35fc9c2 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -812,6 +812,12 @@ NumericField::NumericField( vcl::Window* pParent, const ResId& rResId ) :
Show();
}
+void NumericField::dispose()
+{
+ NumericFormatter::SetField( NULL );
+ SpinField::dispose();
+}
+
bool NumericField::set_property(const OString &rKey, const OString &rValue)
{
if (rKey == "digits")
@@ -961,6 +967,12 @@ NumericBox::NumericBox( vcl::Window* pParent, WinBits nWinStyle ) :
Show();
}
+void NumericBox::dispose()
+{
+ NumericFormatter::SetField( NULL );
+ ComboBox::dispose();
+}
+
Size NumericBox::CalcMinimumSize() const
{
Size aRet(calcMinimumSize(*this, *this));
@@ -1636,6 +1648,12 @@ MetricField::MetricField( vcl::Window* pParent, const ResId& rResId ) :
Show();
}
+void MetricField::dispose()
+{
+ MetricFormatter::SetField( NULL );
+ SpinField::dispose();
+}
+
Size MetricField::CalcMinimumSize() const
{
return calcMinimumSize(*this, *this);
@@ -1800,6 +1818,12 @@ MetricBox::MetricBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void MetricBox::dispose()
+{
+ MetricFormatter::SetField(NULL);
+ ComboBox::dispose();
+}
+
Size MetricBox::CalcMinimumSize() const
{
Size aRet(calcMinimumSize(*this, *this));
@@ -2040,6 +2064,12 @@ CurrencyField::CurrencyField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void CurrencyField::dispose()
+{
+ CurrencyFormatter::SetField( NULL );
+ SpinField::dispose();
+}
+
bool CurrencyField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -2118,6 +2148,12 @@ CurrencyBox::CurrencyBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void CurrencyBox::dispose()
+{
+ CurrencyFormatter::SetField( NULL );
+ ComboBox::dispose();
+}
+
bool CurrencyBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index c9253f89ac9f..aaca5de048c0 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -819,6 +819,12 @@ PatternField::PatternField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void PatternField::dispose()
+{
+ PatternFormatter::SetField( NULL );
+ SpinField::dispose();
+}
+
bool PatternField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -865,6 +871,12 @@ PatternBox::PatternBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void PatternBox::dispose()
+{
+ PatternFormatter::SetField( NULL );
+ ComboBox::dispose();
+}
+
bool PatternBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -1729,6 +1741,12 @@ DateField::DateField( vcl::Window* pParent, WinBits nWinStyle ) :
ResetLastDate();
}
+void DateField::dispose()
+{
+ DateFormatter::SetField( NULL );
+ SpinField::dispose();
+}
+
bool DateField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() &&
@@ -1828,6 +1846,12 @@ DateBox::DateBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void DateBox::dispose()
+{
+ DateFormatter::SetField( NULL );
+ ComboBox::dispose();
+}
+
bool DateBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() &&
@@ -2515,6 +2539,12 @@ TimeField::TimeField( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void TimeField::dispose()
+{
+ TimeFormatter::SetField( NULL );
+ SpinField::dispose();
+}
+
bool TimeField::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
@@ -2652,6 +2682,12 @@ TimeBox::TimeBox( vcl::Window* pParent, WinBits nWinStyle ) :
Reformat();
}
+void TimeBox::dispose()
+{
+ TimeFormatter::SetField( NULL );
+ ComboBox::dispose();
+}
+
bool TimeBox::PreNotify( NotifyEvent& rNEvt )
{
if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )