vcl/source/window/menu.cxx |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 0349ef0fd8d85730e4b2b9f419868b2cef50868c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Feb 10 12:47:01 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Feb 10 15:47:08 2021 +0100

    Related: tdf#140225 when clearing pItemList, keep SalMenu in sync
    
    with their removal during menu teardown
    
    Change-Id: Ic5555372112c5717cbc39c38c6172344e807deb5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110703
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 3cffab6e3b20..aa7afb062f15 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -213,7 +213,18 @@ void Menu::dispose()
 
     bKilled = true;
 
-    pItemList->Clear();
+    // tdf#140225 when clearing pItemList, keep SalMenu in sync with
+    // their removal during menu teardown
+    for (size_t n = pItemList->size(); n;)
+    {
+        --n;
+        if (mpSalMenu)
+            mpSalMenu->RemoveItem(n);
+        pItemList->Remove(n);
+    }
+
+    assert(!pItemList->size());
+
     mpLayoutData.reset();
 
     // Native-support: destroy SalMenu
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to