cui/source/dialogs/SpellDialog.cxx |    6 +++++-
 cui/source/inc/SpellDialog.hxx     |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit f0d20b1a7c5369bb205d43f85d4658febbaac006
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Jan 26 10:12:15 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jan 30 16:30:16 2023 +0000

    fix online crash in SpellDialog
    
    program/libmergedlo.so
       EditEngine::GetUndoManager()
       /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:173
    program/libcuilo.so
       svx::SpellDialog::InitHdl(void*)
       cui/source/dialogs/SpellDialog.cxx:2016
    program/libmergedlo.so
       ImplWindowFrameProc(vcl::Window*, SalEvent, void const*)
       include/rtl/ref.hxx:128
    program/libmergedlo.so
       SvpSalInstance::ProcessEvent(SalUserEventList::SalUserEvent)
       vcl/headless/svpinst.cxx:317
    
    Change-Id: Icd79faea8b066e0725c5d96f5d9b64445578f3a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146161
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/cui/source/dialogs/SpellDialog.cxx 
b/cui/source/dialogs/SpellDialog.cxx
index 9f110c6a5aa1..1c847e8ed97c 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -160,6 +160,7 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* 
pChildWindow,
     : SfxModelessDialogController (_pBindings, pChildWindow,
         pParent, "cui/ui/spellingdialog.ui", "SpellingDialog")
     , aDialogUndoLink(LINK (this, SpellDialog, DialogUndoHdl))
+    , m_pInitHdlEvent(nullptr)
     , bFocusLocked(true)
     , rParent(*pChildWindow)
     , pImpl( new SpellDialog_Impl )
@@ -218,11 +219,13 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* 
pChildWindow,
     //InitHdl wants to use virtual methods, so it
     //can't be called during the ctor, so init
     //it on next event cycle post-ctor
-    Application::PostUserEvent(LINK(this, SpellDialog, InitHdl));
+    m_pInitHdlEvent = Application::PostUserEvent(LINK(this, SpellDialog, 
InitHdl));
 }
 
 SpellDialog::~SpellDialog()
 {
+    if (m_pInitHdlEvent)
+        Application::RemoveUserEvent(m_pInitHdlEvent);
     if (pImpl)
     {
         // save possibly modified user-dictionaries
@@ -392,6 +395,7 @@ void 
SpellDialog::SpellContinue_Impl(std::unique_ptr<UndoChangeGroupGuard>* pGua
  */
 IMPL_LINK_NOARG( SpellDialog, InitHdl, void*, void)
 {
+    m_pInitHdlEvent = nullptr;
     m_xDialog->freeze();
     //show or hide AutoCorrect depending on the modules abilities
     m_xAutoCorrPB->set_visible(rParent.HasAutoCorrection());
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 69f491fc6586..da5fee960c84 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -130,7 +130,7 @@ private:
     OUString        m_sTitleSpellingGrammar;
 
     Link<SpellUndoAction_Impl&,void> aDialogUndoLink;
-
+    ImplSVEvent *   m_pInitHdlEvent;
     bool            bFocusLocked;
 
     svx::SpellDialogChildWindow& rParent;

Reply via email to