[Libreoffice-commits] core.git: include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 13 13:30:36 UTC 2020


 include/vcl/toolkit/fmtfield.hxx |    2 ++
 vcl/source/control/fmtfield.cxx  |   10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 47a02f1f34bea80f568a292799c6bc621edbc797
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 13 10:38:13 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 13 15:29:43 2020 +0200

    drop m_xFormatter during dispose
    
    Change-Id: I7e5a0259072ae644bbf187737cecdf2f7b0459d0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98652
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/toolkit/fmtfield.hxx b/include/vcl/toolkit/fmtfield.hxx
index 8960d09406ea..af2be6bd741f 100644
--- a/include/vcl/toolkit/fmtfield.hxx
+++ b/include/vcl/toolkit/fmtfield.hxx
@@ -31,6 +31,8 @@ class VCL_DLLPUBLIC FormattedField : public SpinField
 public:
     FormattedField(vcl::Window* pParent, WinBits nStyle);
 
+    virtual void dispose() override;
+
     // Spin-Handling
     virtual void Up() override;
     virtual void Down() override;
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index 391e9b98870f..52f959056dda 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -1150,6 +1150,12 @@ FormattedField::FormattedField(vcl::Window* pParent, WinBits nStyle)
 {
 }
 
+void FormattedField::dispose()
+{
+    m_xFormatter.reset();
+    SpinField::dispose();
+}
+
 void FormattedField::SetText(const OUString& rStr)
 {
     GetFormatter().SetFieldText(rStr, Selection(0, 0));
@@ -1294,8 +1300,8 @@ bool FormattedField::EventNotify(NotifyEvent& rNEvt)
         }
     }
 
-    if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS)
-        GetFormatter().EntryLostFocus();
+    if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && m_xFormatter)
+        m_xFormatter->EntryLostFocus();
 
     return SpinField::EventNotify( rNEvt );
 }


More information about the Libreoffice-commits mailing list