[Libreoffice-commits] core.git: cui/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 2 20:08:33 UTC 2020


 cui/source/options/treeopt.cxx |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 0eb6ad223272325278d52e21d4fb257025d3b54c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 2 15:03:01 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 2 21:07:39 2020 +0100

    tdf#138596 don't destroy SfxItemSet that are still in use
    
    update the existing ones instead
    
    Change-Id: I67fd6c4ecb5d4294efae0262d558281e6840b5dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107079
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index e098040e7c7c..968d3f6c14cc 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -724,13 +724,18 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
         m_xDialog->response(RET_OK);
     else
     {
-        // tdf#137930 rebuild the in and out itemsets
-        // to reflect the current post-apply state
+        // tdf#137930 rebuild the in and out itemsets to reflect the current
+        // post-apply state
         if (pGroupInfo && pGroupInfo->m_pInItemSet)
         {
-            pGroupInfo->m_pInItemSet.reset();
-            pGroupInfo->m_pOutItemSet.reset();
-            InitItemSets(*pGroupInfo);
+            // tdf#138596 seeing as the SfxTabPages keep pointers to the m_pInItemSet
+            // we update the contents of the existing SfxItemSets to match
+            // the current settings, rather than create new ones
+            auto xInItemSet = pGroupInfo->m_pShell
+                ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId )
+                : CreateItemSet( pGroupInfo->m_nDialogId );
+            pGroupInfo->m_pInItemSet->Set(*xInItemSet, false);
+            pGroupInfo->m_pOutItemSet->ClearItem();
         }
 
         // for the Apply case, now that the settings are saved to config,


More information about the Libreoffice-commits mailing list