diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-10 12:47:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-10 15:47:08 +0100 |
commit | 0349ef0fd8d85730e4b2b9f419868b2cef50868c (patch) | |
tree | c02f078f197b7eed495085ca1182eb72671c0af1 | |
parent | 97a2416f90a0eec6eab0e939502450499bd3f383 (diff) |
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 <caolanm@redhat.com>
-rw-r--r-- | vcl/source/window/menu.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
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 |