[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/vcl sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 24 10:10:45 UTC 2019


 include/vcl/weld.hxx            |    3 ++-
 sfx2/source/dialog/basedlgs.cxx |    6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit ca477f5e0e3b8cd28f6beaf96a20e70064d73ea3
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Oct 24 08:43:59 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 24 12:09:39 2019 +0200

    tdf#128077 crash with calc dialogs and multiple windows
    
    regression from
        commit bf359d01ac8b1e0292e8a92c38e58c03e6c17d8b
        add a Dialog::runAsync for the non-controller case
    we end up destroying the dialog controller while the controller is in
    it's own method, so keep it alive for the duration.
    
    Change-Id: I0f26b4d40351ad62378f58c560f1a6d69d57a88e
    Reviewed-on: https://gerrit.libreoffice.org/81425
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 7364a206a67f73513590fbb55e9e1d630c97aab1)
    Reviewed-on: https://gerrit.libreoffice.org/81432

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 775e2c0da479..8d7f509018fb 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
 #include <com/sun/star/accessibility/XAccessible.hpp>
 
+#include <memory>
 #include <vector>
 
 namespace com
@@ -1853,7 +1854,7 @@ public:
     virtual ~Builder() {}
 };
 
-class VCL_DLLPUBLIC DialogController
+class VCL_DLLPUBLIC DialogController : public std::enable_shared_from_this<DialogController>
 {
 public:
     virtual Dialog* getDialog() = 0;
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 0d4da9eaaef9..24ea723a0dac 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -471,6 +471,12 @@ bool SfxModelessDialogController::IsClosing() const
 
 void SfxModelessDialogController::EndDialog()
 {
+    if (m_xImpl->bClosing)
+        return;
+    // In the case of async dialogs, the call to SfxDialogController::EndDialog
+    // may delete this object, so keep myself alive for the duration of this
+    // stack frame.
+    auto aHoldSelf = shared_from_this();
     m_xImpl->bClosing = true;
     SfxDialogController::EndDialog();
     if (!m_xImpl)


More information about the Libreoffice-commits mailing list