external/liborcus/UnpackedTarball_liborcus.mk |    3 ++
 external/liborcus/forcepoint-84.patch.1       |   38 ++++++++++++++++++++++++++
 include/sfx2/strings.hrc                      |    2 +
 include/sfx2/viewfrm.hxx                      |    1 
 oox/source/export/drawingml.cxx               |    5 +++
 oox/source/export/shapes.cxx                  |    1 
 sc/inc/chartlis.hxx                           |    2 -
 sc/inc/externalrefmgr.hxx                     |    2 -
 sc/source/core/tool/chartlis.cxx              |    9 ++++--
 sc/source/ui/docshell/externalrefmgr.cxx      |    8 +++++
 sc/source/ui/unoobj/chart2uno.cxx             |    3 ++
 sd/qa/unit/data/odp/tdf53970.odp              |binary
 sd/qa/unit/export-tests-ooxml2.cxx            |   15 ++++++++++
 sfx2/source/view/viewfrm.cxx                  |   38 ++++++++++++++++++++++++++
 sw/qa/extras/layout/data/forcepoint94.html    |binary
 sw/qa/extras/layout/layout.cxx                |    6 ++++
 sw/qa/inc/swmodeltestbase.hxx                 |   17 ++++++++++-
 sw/qa/unit/swmodeltestbase.cxx                |   24 ++++++++++++++--
 sw/source/core/layout/ftnfrm.cxx              |    3 ++
 19 files changed, 168 insertions(+), 9 deletions(-)

New commits:
commit 32061680dd379bef98ea4e55cd2b9f7a5fdc801b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Mar 23 13:03:30 2022 +0000
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 6 12:42:01 2022 +0200

    add infobar to prompt to refresh to replace old format
    
    Change-Id: Id99cbf2b50a4ebf289dae6fc67e22e20afcda35b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131976
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit bbd196ff82bda9f66b4ba32a412f10cefe6da60e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132187
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Reviewed-by: Sophie Gautier <so...@libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index 82bd1c2168a1..c5948e316ed4 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -291,6 +291,8 @@
 #define STR_TRACK_CHANGES_BUTTON                
NC_("STR_TRACK_CHANGES_BUTTON", "Show Toolbar")
 #define STR_TRACK_CHANGES_BUTTON_HIDE           
NC_("STR_TRACK_CHANGES_BUTTON_HIDE", "Hide Toolbar")
 #define STR_HYPHENATION_BUTTON                  NC_("STR_HYPHENATION_BUTTON", 
"Learn more")
+#define STR_REFRESH_MASTER_PASSWORD             
NC_("STR_REFRESH_MASTER_PASSWORD", "The master password is stored in an 
outdated format, you should refresh it")
+#define STR_REFRESH_PASSWORD                    NC_("STR_REFRESH_PASSWORD", 
"Refresh Password")
 
 #define STR_CLOSE_PANE                          NC_("STR_CLOSE_PANE", "Close 
Pane")
 
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index e52a1ec437a4..24d1c35dbe90 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -68,6 +68,7 @@ class SFX2_DLLPUBLIC SfxViewFrame final : public SfxShell, 
public SfxListener
     DECL_DLLPRIVATE_LINK(SignDocumentHandler, weld::Button&, void);
     DECL_DLLPRIVATE_LINK(HiddenTrackChangesHandler, weld::Button&, void);
     DECL_DLLPRIVATE_LINK(HyphenationMissingHandler, weld::Button&, void);
+    DECL_DLLPRIVATE_LINK(RefreshMasterPasswordHdl, weld::Button&, void);
     SAL_DLLPRIVATE void KillDispatcher_Impl();
 
     virtual                 ~SfxViewFrame() override;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3b76f643f77a..fd66caabd0d4 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -33,6 +33,7 @@
 #include <com/sun/star/frame/XLoadable.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/task/PasswordContainer.hpp>
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Setup.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
@@ -1418,6 +1419,22 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, 
const SfxHint& rHint )
                     GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, 
SfxCallMode::SLOT, {}, { &aDocFrame });
                 }
 
+                if (officecfg::Office::Common::Passwords::HasMaster::get() &&
+                    
officecfg::Office::Common::Passwords::StorageVersion::get() == 0)
+                {
+                    // master password stored in deprecated format
+                    VclPtr<SfxInfoBarWindow> pOldMasterPasswordInfoBar =
+                        AppendInfoBar("oldmasterpassword", "",
+                                      SfxResId(STR_REFRESH_MASTER_PASSWORD), 
InfobarType::DANGER, false);
+                    if (pOldMasterPasswordInfoBar)
+                    {
+                        weld::Button& rButton = 
pOldMasterPasswordInfoBar->addButton();
+                        rButton.set_label(SfxResId(STR_REFRESH_PASSWORD));
+                        rButton.connect_clicked(LINK(this,
+                                                   SfxViewFrame, 
RefreshMasterPasswordHdl));
+                    }
+                }
+
                 // read-only infobar if necessary
                 const SfxViewShell *pVSh;
                 const SfxShell *pFSh;
@@ -1628,6 +1645,27 @@ IMPL_LINK_NOARG(SfxViewFrame, HyphenationMissingHandler, 
weld::Button&, void)
     RemoveInfoBar(u"hyphenationmissing");
 }
 
+IMPL_LINK_NOARG(SfxViewFrame, RefreshMasterPasswordHdl, weld::Button&, void)
+{
+    bool bChanged = false;
+    try
+    {
+        Reference< task::XPasswordContainer2 > xMasterPasswd(
+            
task::PasswordContainer::create(comphelper::getProcessComponentContext()));
+
+        css::uno::Reference<css::frame::XFrame> xFrame = 
GetFrame().GetFrameInterface();
+        css::uno::Reference<css::awt::XWindow> xContainerWindow = 
xFrame->getContainerWindow();
+
+        uno::Reference<task::XInteractionHandler> 
xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(),
+                                                              
xContainerWindow));
+        bChanged = xMasterPasswd->changeMasterPassword(xTmpHandler);
+    }
+    catch (const Exception&)
+    {}
+    if (bChanged)
+        RemoveInfoBar(u"oldmasterpassword");
+}
+
 void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh )
 {
     m_pImpl->bResizeInToOut = true;
commit 7439d5d371dbfca5f09750d939d8b0db1594b08d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Mar 23 20:08:19 2022 +0000
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 6 12:41:11 2022 +0200

    forcepoint#84 Invalid read of size 1
    
    Change-Id: I1d0d74940cfa78a3c88cee737c9535acf03e0f19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131991
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit d6a02a99eaa3690c0aa5c33fea3a4c710813a0de)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132188
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/external/liborcus/UnpackedTarball_liborcus.mk 
b/external/liborcus/UnpackedTarball_liborcus.mk
index a87da7edb88d..8f41fdbf9173 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -17,6 +17,8 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,liborcus))
 
 # forcepoint-83.patch.1 submitted as
 # https://gitlab.com/orcus/orcus/-/merge_requests/117
+# forcepoint-84.patch.1 submitted as
+# https://gitlab.com/orcus/orcus/-/merge_requests/118
 
 $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
        external/liborcus/rpath.patch.0 \
@@ -26,6 +28,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
        external/liborcus/liborcus_newline.patch.1 \
        external/liborcus/std-get-busted.patch.1 \
        external/liborcus/forcepoint-83.patch.1 \
+       external/liborcus/forcepoint-84.patch.1 \
 ))
 
 ifeq ($(OS),WNT)
diff --git a/external/liborcus/forcepoint-84.patch.1 
b/external/liborcus/forcepoint-84.patch.1
new file mode 100644
index 000000000000..99aa0b9623b5
--- /dev/null
+++ b/external/liborcus/forcepoint-84.patch.1
@@ -0,0 +1,38 @@
+From 0fee6c0e3074be11874f1911a76f10eef5f59985 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caol...@redhat.com>
+Date: Wed, 23 Mar 2022 20:04:31 +0000
+Subject: [PATCH] forcepoint#84 Invalid read of size 1
+
+==356879== Invalid read of size 1
+==356879==    at 0x11EC50B0: orcus::parser_base::cur_char() const 
(parser_base.hpp:79)
+==356879==    by 0x11EDD736: 
orcus::sax::parser_base::value(std::basic_string_view<char, 
std::char_traits<char> >&, bool) (sax_parser_base.cpp:303)
+==356879==    by 0x11B7C3D5: 
orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper,
 orcus::sax_parser_default_config>::attribute() (sax_parser.hpp:563)
+==356879==    by 0x11B7B35E: 
orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper,
 orcus::sax_parser_default_config>::element_open(long) (sax_parser.hpp:292)
+==356879==    by 0x11B7A2F7: 
orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper,
 orcus::sax_parser_default_config>::element() (sax_parser.hpp:246)
+==356879==    by 0x11B7A1C7: 
orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper,
 orcus::sax_parser_default_config>::body() (sax_parser.hpp:214)
+==356879==    by 0x11B7A009: 
orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper,
 orcus::sax_parser_default_config>::parse() (sax_parser.hpp:182)
+==356879==    by 0x11B79FBB: 
orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::parse()
 (sax_ns_parser.hpp:277)
+==356879==    by 0x11B79798: 
orcus::sax_token_parser<orcus::xml_stream_handler>::parse() 
(sax_token_parser.hpp:215)
+==356879==    by 0x11B79436: orcus::xml_stream_parser::parse() 
(xml_stream_parser.cpp:68)
+==356879==    by 0x11BE3855: orcus::orcus_xlsx::detect(unsigned char const*, 
unsigned long) (orcus_xlsx.cpp:188)
+==356879==    by 0x11AB2492: orcus::detect(unsigned char const*, unsigned 
long) (format_detection.cpp:60)
+---
+ src/parser/sax_parser_base.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/parser/sax_parser_base.cpp b/src/parser/sax_parser_base.cpp
+index 46acb81d..11791edc 100644
+--- a/src/parser/sax_parser_base.cpp
++++ b/src/parser/sax_parser_base.cpp
+@@ -300,6 +300,8 @@ void parser_base::value_with_encoded_char(cell_buffer& 
buf, std::string_view& st
+ 
+ bool parser_base::value(std::string_view& str, bool decode)
+ {
++    if (!has_char())
++        throw malformed_xml_error("value must be quoted", offset());
+     char c = cur_char();
+     if (c != '"' && c != '\'')
+         throw malformed_xml_error("value must be quoted", offset());
+-- 
+2.35.1
+
commit aa7abaabf72e9768a359d7695304926b7777cdb3
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Mar 27 20:51:48 2022 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 6 12:41:11 2022 +0200

    forcepoint#94 fix crash on layout of specific html
    
    Change-Id: I1874a431d5af9d56248a695e08a2f95b5292ba9a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132179
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/qa/extras/layout/data/forcepoint94.html 
b/sw/qa/extras/layout/data/forcepoint94.html
new file mode 100644
index 000000000000..8be788f8e4e5
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint94.html differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 149f45a8f13e..fd48e9da9a2c 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2508,6 +2508,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92)
     createSwDoc(DATA_DIRECTORY, "forcepoint92.doc");
 }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94)
+{
+    createSwWebDoc(DATA_DIRECTORY, "forcepoint94.html");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058)
 {
     SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118058.fodt");
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index c41b315ad685..ba0cde71e7ea 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2860,6 +2860,9 @@ bool SwContentFrame::MoveFootnoteCntFwd( bool bMakePage, 
SwFootnoteBossFrame *pO
                             OSL_ENSURE( pTmp->IsTabFrame(), "GetNextSctLeaf: 
Wrong Type" );
                             pTmpNxt = static_cast<SwTabFrame*>(pTmp);
                         }
+                        // we will dereference pNewUp in the following 
MoveSubTree call
+                        // so it certainly should not be deleted before that
+                        SwFrameDeleteGuard aDeleteGuard(pNewUp);
                         pTmpNxt->MoveSubTree( pTmpFootnote, pNewUp->GetNext() 
);
                     }
                 }
commit 5d46ec11f6405433ec996c18e471d3f61d7d5113
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Wed Mar 30 09:52:57 2022 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 6 12:41:11 2022 +0200

    tdf#53970 PPTX: add unittest
    
    Change-Id: I1bcf8f79213245fdf135d6d3b2aafea6ed99f5b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132296
    Tested-by: Jenkins
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132320

diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 78f43f2160eb..6afe97292ea8 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -152,6 +152,7 @@ public:
     void testTextColumns_tdf140852();
     void testTextColumns_3columns();
     void testTdf59323_slideFooters();
+    void testTdf53970();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -218,6 +219,7 @@ public:
     CPPUNIT_TEST(testTextColumns_tdf140852);
     CPPUNIT_TEST(testTextColumns_3columns);
     CPPUNIT_TEST(testTdf59323_slideFooters);
+    CPPUNIT_TEST(testTdf53970);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1810,6 +1812,19 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf53970()
+{
+    ::sd::DrawDocShellRef xDocShRef
+        = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+
+    // Without fix in place, the media shape was lost on export.
+    CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 934aa454dda19928608ca7f1e33f3852c3088c3c
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Thu Mar 24 16:54:01 2022 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 6 12:41:11 2022 +0200

    tdf#53970 PPTX: fix export of embedded media files
    
    Embedded media files lost in documents created
    with Impress after PPTX export.
    
    Change-Id: I453b58f9cfa6a33653e9216fb82b66970a9ec31b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132095
    Tested-by: Jenkins
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132319

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 708aea6fb29a..4d0317be921d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1343,6 +1343,11 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::Reference<css::dra
             aMimeType = "audio/mp4";
             eMediaType = Relationship::AUDIO;
         }
+        else if (aExtension.equalsIgnoreAsciiCase(".mp3"))
+        {
+            aMimeType = "audio/mp3";
+            eMediaType = Relationship::AUDIO;
+        }
     }
 
     OUString aVideoFileRelId;
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7bc505e77481..86ca6264129d 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1657,6 +1657,7 @@ static const NameToConvertMapType& lcl_GetConverters()
         { "com.sun.star.drawing.EllipseShape"              , 
&ShapeExport::WriteEllipseShape },
         { "com.sun.star.drawing.GraphicObjectShape"        , 
&ShapeExport::WriteGraphicObjectShape },
         { "com.sun.star.drawing.LineShape"                 , 
&ShapeExport::WriteLineShape },
+        { "com.sun.star.drawing.MediaShape"                , 
&ShapeExport::WriteGraphicObjectShape },
         { "com.sun.star.drawing.OpenBezierShape"           , 
&ShapeExport::WriteOpenPolyPolygonShape },
         { "com.sun.star.drawing.PolyPolygonShape"          , 
&ShapeExport::WriteClosedPolyPolygonShape },
         { "com.sun.star.drawing.PolyLineShape"             , 
&ShapeExport::WriteOpenPolyPolygonShape },
diff --git a/sd/qa/unit/data/odp/tdf53970.odp b/sd/qa/unit/data/odp/tdf53970.odp
new file mode 100644
index 000000000000..0d48cf5d6601
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf53970.odp differ
commit 50e4bac083869df17eeb40ff3ebcf953dcb8db6f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Mar 28 20:07:24 2022 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 6 12:41:11 2022 +0200

    sc: fix use after free in ScChart2DataSequence::ExternalRefListener
    
    UITest_chart: tdf122011.tdf122011.test_tdf122011
    
    ERROR: AddressSanitizer: heap-use-after-free on address 0x61e00007a13e at 
pc 0x7f9a88217e2b bp 0x7f9a901e7ab0 sp 0x7f9a901e7aa8
    READ of size 1 at 0x61e00007a13e thread T53
        #0 ScDocument::IsInDtorClear() const sc/inc/document.hxx:2421:56
        #1 ScChart2DataSequence::ExternalRefListener::~ExternalRefListener() 
sc/source/ui/unoobj/chart2uno.cxx:2897:26
        #4 ScChart2DataSequence::~ScChart2DataSequence() 
sc/source/ui/unoobj/chart2uno.cxx:2458:1
        #6 cppu::OWeakObject::release() cppuhelper/source/weak.cxx:230:9
        #8 
com::sun::star::uno::Reference<com::sun::star::chart2::data::XDataSequence>::~Reference()
 include/com/sun/star/uno/Reference.hxx:114:22
        #9 chart::LabeledDataSequence::~LabeledDataSequence() 
chart2/source/tools/LabeledDataSequence.cxx:89:1
        #11 cppu::OWeakObject::release() cppuhelper/source/weak.cxx:230:9
        #12 
cppu::WeakImplHelper<com::sun::star::chart2::data::XLabeledDataSequence2, 
com::sun::star::lang::XServiceInfo>::release() 
include/cppuhelper/implbase.hxx:115:66
        #13 
com::sun::star::uno::Reference<com::sun::star::chart2::data::XLabeledDataSequence>::~Reference()
 include/com/sun/star/uno/Reference.hxx:114:22
        #20 chart::DataSeries::~DataSeries() 
chart2/source/model/main/DataSeries.cxx:218:1
        #24 chart::DataSeries::release() 
chart2/source/model/main/DataSeries.cxx:537:1
        #25 rtl::Reference<chart::DataSeries>::~Reference() 
include/rtl/ref.hxx:129:22
        #32 std::__debug::vector<rtl::Reference<chart::DataSeries>, 
std::allocator<rtl::Reference<chart::DataSeries> > >::clear() 
/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/debug/vector:720:9
        #33 chart::ChartType::~ChartType() 
chart2/source/model/template/ChartType.cxx:65:19
        #34 chart::ColumnChartType::~ColumnChartType() 
chart2/source/model/template/ColumnChartType.cxx:134:2
        #36 cppu::OWeakObject::release() cppuhelper/source/weak.cxx:230:9
        #38 chart::ChartType::release() 
chart2/source/model/template/ChartType.cxx:330:1
        #39 rtl::Reference<chart::ChartType>::~Reference() 
include/rtl/ref.hxx:129:22
        #46 chart::BaseCoordinateSystem::~BaseCoordinateSystem() 
chart2/source/model/main/BaseCoordinateSystem.cxx:185:1
        #47 chart::CartesianCoordinateSystem::~CartesianCoordinateSystem() 
chart2/source/model/main/CartesianCoordinateSystem.cxx:53:2
        #49 cppu::OWeakObject::release() cppuhelper/source/weak.cxx:230:9
        #51 chart::BaseCoordinateSystem::release() 
chart2/source/model/main/BaseCoordinateSystem.cxx:406:1
        #52 rtl::Reference<chart::BaseCoordinateSystem>::~Reference() 
include/rtl/ref.hxx:129:22
        #53 chart::VCoordinateSystem::~VCoordinateSystem() 
chart2/source/view/axes/VCoordinateSystem.cxx:89:1
        #55 chart::VCartesianCoordinateSystem::~VCartesianCoordinateSystem() 
chart2/source/view/axes/VCartesianCoordinateSystem.cxx:69:1
        #65 chart::ChartView::impl_deleteCoordinateSystems() 
chart2/source/view/main/ChartView.cxx:1091:20
        #66 chart::ChartView::~ChartView() 
chart2/source/view/main/ChartView.cxx:1085:5
        #68 cppu::OWeakObject::release() cppuhelper/source/weak.cxx:230:9
        #70 rtl::Reference<chart::ChartView>::~Reference() 
include/rtl/ref.hxx:129:22
        #71 chart::ChartModel::~ChartModel() 
chart2/source/model/main/ChartModel.cxx:183:1
        #73 cppu::OWeakObject::release() cppuhelper/source/weak.cxx:230:9
        #75 rtl::Reference<chart::ChartModel>::clear() 
include/rtl/ref.hxx:196:19
        #76 chart::CreationWizardUnoDlg::disposing() 
chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx:235:19
        #77 cppu::OComponentHelper::dispose() 
cppuhelper/source/component.cxx:161:17
        #78 
chart::CreationWizardUnoDlg::notifyTermination(com::sun::star::lang::EventObject
 const&) chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx:140:5
        #79 framework::Desktop::impl_sendNotifyTerminationEvent() 
framework/source/services/desktop.cxx:1649:79
        #80 framework::Desktop::terminate() 
framework/source/services/desktop.cxx:282:13
    
    0x61e00007a13e is located 2238 bytes inside of 2712-byte region 
[0x61e000079880,0x61e00007a318)
    freed by thread T53 here:
        #0 0x4fe267 in operator delete(void*) 
(instdir/program/soffice.bin+0x4fe267)
        #1 ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2899:1
        #2 SvRefBase::ReleaseRef() include/tools/ref.hxx:163:29
        #3 tools::SvRef<SfxObjectShell>::~SvRef() include/tools/ref.hxx:56:36
        #4 IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() 
sfx2/source/doc/sfxbasemodel.cxx:245:5
        #12 SfxBaseModel::dispose() sfx2/source/doc/sfxbasemodel.cxx:757:13
        #13 SfxBaseModel::close(unsigned char) 
sfx2/source/doc/sfxbasemodel.cxx:1482:5
        #14 SfxBaseModel::dispose() sfx2/source/doc/sfxbasemodel.cxx:718:13
        #15 gcc3::callVirtualMethod(void*, unsigned int, void*, 
_typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, 
unsigned long*, double*) 
bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77:5
    
    Change-Id: I4ac7a702c50f9519a0f982ece9776c2d449c43ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132242
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit c87bbaa87e2532c7601e8588d87de1dc4952f098)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132183
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index 3273a61a1da2..7e351082f4f7 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -56,7 +56,7 @@ public:
 
         ScChartListener& mrParent;
         std::unordered_set<sal_uInt16> maFileIds;
-        ScDocument&                 mrDoc;
+        ScDocument* m_pDoc;
     };
 
 private:
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index f3594678e89e..3fe5e591ebfd 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -374,7 +374,7 @@ public:
     typedef std::set<ScFormulaCell*>                      RefCellSet;
     typedef std::unordered_map<sal_uInt16, RefCellSet>         RefCellMap;
 
-    enum LinkUpdateType { LINK_MODIFIED, LINK_BROKEN };
+    enum LinkUpdateType { LINK_MODIFIED, LINK_BROKEN, 
OH_NO_WE_ARE_GOING_TO_DIE };
 
     /**
      * Base class for objects that need to listen to link updates.  When a
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 18b69b12d92b..3566e357f67b 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -50,18 +50,18 @@ public:
 
 // ScChartListener
 ScChartListener::ExternalRefListener::ExternalRefListener(ScChartListener& 
rParent, ScDocument& rDoc) :
-    mrParent(rParent), mrDoc(rDoc)
+    mrParent(rParent), m_pDoc(&rDoc)
 {
 }
 
 ScChartListener::ExternalRefListener::~ExternalRefListener()
 {
-    if (mrDoc.IsInDtorClear())
+    if (!m_pDoc || m_pDoc->IsInDtorClear())
         // The document is being destroyed.  Do nothing.
         return;
 
     // Make sure to remove all pointers to this object.
-    mrDoc.GetExternalRefManager()->removeLinkListener(this);
+    m_pDoc->GetExternalRefManager()->removeLinkListener(this);
 }
 
 void ScChartListener::ExternalRefListener::notify(sal_uInt16 nFileId, 
ScExternalRefManager::LinkUpdateType eType)
@@ -79,6 +79,9 @@ void ScChartListener::ExternalRefListener::notify(sal_uInt16 
nFileId, ScExternal
         case ScExternalRefManager::LINK_BROKEN:
             removeFileId(nFileId);
         break;
+        case ScExternalRefManager::OH_NO_WE_ARE_GOING_TO_DIE:
+            m_pDoc = nullptr;
+        break;
     }
 }
 
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index fad6eb0a3047..4e0512a711a6 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -3104,6 +3104,14 @@ void ScExternalRefManager::setFilterData(sal_uInt16 
nFileId, const OUString& rFi
 
 void ScExternalRefManager::clear()
 {
+    for (auto& rEntry : maLinkListeners)
+    {
+        for (auto& it : rEntry.second)
+        {
+            it->notify(0, OH_NO_WE_ARE_GOING_TO_DIE);
+        }
+    }
+
     for (auto& rEntry : maDocShells)
         rEntry.second.maShell->DoClose();
 
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 2d25017e40f0..54a88b749a77 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2916,6 +2916,9 @@ void 
ScChart2DataSequence::ExternalRefListener::notify(sal_uInt16 nFileId, ScExt
         case ScExternalRefManager::LINK_BROKEN:
             maFileIds.erase(nFileId);
         break;
+        case ScExternalRefManager::OH_NO_WE_ARE_GOING_TO_DIE:
+            mpDoc = nullptr;
+        break;
     }
 }
 
commit b3d0f79573e77a0531fd2410e0baad3e7b40e450
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Mar 25 14:01:47 2022 +0000
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 6 12:41:10 2022 +0200

    add support to explicitly test swriter/sweb layout
    
    Change-Id: Ib47526d35428a95b081c88011d733397339f288d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132121
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit bd769805180c9b0aadca5301e29161c2d84fbe64)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132182

diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 65b673789a78..7a9ac5dcc8a2 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -325,11 +325,20 @@ protected:
 
     void load(std::u16string_view pDir, const char* pName, const char* 
pPassword = nullptr)
     {
-        return loadURL(m_directories.getURLFromSrc(pDir) + 
OUString::createFromAscii(pName), pName, pPassword);
+        return loadURLWithComponent(m_directories.getURLFromSrc(pDir) + 
OUString::createFromAscii(pName),
+                                    "com.sun.star.text.TextDocument", pName, 
pPassword);
+    }
+
+    void load_web(std::u16string_view pDir, const char* pName, const char* 
pPassword = nullptr)
+    {
+        return loadURLWithComponent(m_directories.getURLFromSrc(pDir) + 
OUString::createFromAscii(pName),
+                                    "com.sun.star.text.WebDocument", pName, 
pPassword);
     }
 
     void setTestInteractionHandler(const char* pPassword, 
std::vector<beans::PropertyValue>& rFilterOptions);
 
+    void loadURLWithComponent(OUString const& rURL, OUString const& 
rComponent, const char* pName, const char* pPassword);
+
     void loadURL(OUString const& rURL, const char* pName, const char* 
pPassword = nullptr);
 
     void reload(const char* pFilter, const char* filename, const char* 
pPassword = nullptr);
@@ -384,6 +393,12 @@ protected:
      */
     SwDoc* createSwDoc(
         std::u16string_view rDataDirectory = std::u16string_view(), const 
char* pName = nullptr);
+
+    /**
+     * As createSwDoc except a Web Document in Browse Mode
+     */
+    SwDoc* createSwWebDoc(
+        std::u16string_view rDataDirectory = std::u16string_view(), const 
char* pName = nullptr);
 };
 
 /**
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 28ee075120fa..8a8a7d2df5a2 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -478,7 +478,8 @@ void SwModelTestBase::setTestInteractionHandler(const char* 
pPassword,
 
 void SwModelTestBase::header() {}
 
-void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const 
char* pPassword)
+void SwModelTestBase::loadURLWithComponent(OUString const& rURL, OUString 
const& rComponent,
+                                           const char* pName, const char* 
pPassword)
 {
     if (mxComponent.is())
         mxComponent->dispose();
@@ -510,8 +511,8 @@ void SwModelTestBase::loadURL(OUString const& rURL, const 
char* pName, const cha
     if (pName)
         std::cout << pName << ":\n";
     mnStartTime = osl_getGlobalTimer();
-    mxComponent = loadFromDesktop(rURL, "com.sun.star.text.TextDocument",
-                                  
comphelper::containerToSequence(aFilterOptions));
+    mxComponent
+        = loadFromDesktop(rURL, rComponent, 
comphelper::containerToSequence(aFilterOptions));
 
     if (pPassword)
     {
@@ -524,6 +525,11 @@ void SwModelTestBase::loadURL(OUString const& rURL, const 
char* pName, const cha
         calcLayout();
 }
 
+void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const 
char* pPassword)
+{
+    loadURLWithComponent(rURL, "com.sun.star.text.TextDocument", pName, 
pPassword);
+}
+
 void SwModelTestBase::reload(const char* pFilter, const char* filename, const 
char* pPassword)
 {
     uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -727,4 +733,16 @@ SwDoc* SwModelTestBase::createSwDoc(std::u16string_view 
rDataDirectory, const ch
     return pTextDoc->GetDocShell()->GetDoc();
 }
 
+SwDoc* SwModelTestBase::createSwWebDoc(std::u16string_view rDataDirectory, 
const char* pName)
+{
+    if (rDataDirectory.empty() || !pName)
+        loadURL("private:factory/swriter/web", nullptr);
+    else
+        load_web(rDataDirectory, pName);
+
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    return pTextDoc->GetDocShell()->GetDoc();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to