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

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 25 18:12:41 UTC 2020


 sw/source/uibase/utlui/content.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 6d23f2667edc9f8b867066a432dff152f8427ce0
Author:     Jim Raykowski <raykowj at gmail..com>
AuthorDate: Mon Feb 24 23:43:52 2020 -0900
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Tue Feb 25 19:12:06 2020 +0100

    tdf#128814 follow up: check for nullptr and dispose unused sub pop menu
    
    Prevent nullptr crash in lcl_IsContent and dispose and clear sub pop
    outline tracking menu if unused.
    
    Change-Id: I6d3e1a48776426ae18156cc70b799f74f349bf5e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89410
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index d0b1934aa1d8..f70f72815075 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1287,15 +1287,15 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu()
     else if (State::HIDDEN == m_eState)
         pSubPop3->CheckItem( nId );
 
-    SvTreeListEntry* pEntry = nullptr;
-    if (lcl_IsContent(FirstSelected()))
+    SvTreeListEntry* pEntry = FirstSelected();
+    if (pEntry && lcl_IsContent(pEntry))
     {
         pPop->InsertItem(900, SwResId(STR_GOTO));
         pPop->SetAccelKey(900, vcl::KeyCode(KEY_RETURN, false, false, false, false));
     }
     // Edit only if the shown content is coming from the current view.
     if ((State::ACTIVE == m_eState || m_pActiveShell == pActiveView->GetWrtShellPtr())
-            && nullptr != (pEntry = FirstSelected()) && lcl_IsContent(pEntry))
+            && pEntry && lcl_IsContent(pEntry))
     {
         assert(dynamic_cast<SwContent*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())));
         const SwContentType* pContType = static_cast<SwContent*>(pEntry->GetUserData())->GetParent();
@@ -1425,7 +1425,10 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu()
         pPop->SetPopupMenu(1, pSubPop1);
     }
     else
+    {
+        pSubPopOutlineTracking.disposeAndClear();
         pSubPop1.disposeAndClear();
+    }
     pPop->InsertItem(2, m_aContextStrings[IDX_STR_DRAGMODE]);
     pPop->SetPopupMenu(2, pSubPop2);
     pPop->InsertItem(3, m_aContextStrings[IDX_STR_DISPLAY]);


More information about the Libreoffice-commits mailing list