diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 05:03:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 05:09:28 +0000 |
commit | 97ac77f067910fa5e8206d75160fa63546a9358d (patch) | |
tree | e6fa64b43e8150ef65578afa4f1f40f3e19f7fa3 /toolkit/source/awt/vclxmenu.cxx | |
parent | Releasing progress-linux version 4:24.2.2-3~progress7.99u1. (diff) | |
download | libreoffice-97ac77f067910fa5e8206d75160fa63546a9358d.tar.xz libreoffice-97ac77f067910fa5e8206d75160fa63546a9358d.zip |
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/source/awt/vclxmenu.cxx')
-rw-r--r-- | toolkit/source/awt/vclxmenu.cxx | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 20d3d5d2d1..6515258861 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -413,11 +413,30 @@ css::uno::Reference< css::awt::XPopupMenu > VCLXMenu::getPopupMenu( break; } } - // it seems the popup menu is not insert into maPopupMenuRefs - // if the popup men is not created by stardiv.Toolkit.VCLXPopupMenu + /* + If the popup menu is not inserted via setPopupMenu then + maPopupMenuRefs won't have an entry for it, so create an XPopupMenu + for it now. + + This means that this vcl PopupMenu "pMenu" either existed as a child + of the vcl Menu "mpMenu" before the VCLXMenu was created for that or + it was added directly via vcl. + */ if( !aRef.is() ) { aRef = new VCLXPopupMenu( static_cast<PopupMenu*>(pMenu) ); + /* + In any case, the VCLXMenu has ownership of "mpMenu" and will + destroy it in the VCLXMenu dtor. + + Similarly because VCLXPopupMenu takes ownership of the vcl + PopupMenu "pMenu", the underlying vcl popup will be destroyed + when VCLXPopupMenu is, so we should add it now to + maPopupMenuRefs to ensure its lifecycle is at least bound to + the VCLXMenu that owns the parent "mpMenu" similarly to + PopupMenus added via the more conventional setPopupMenu. + */ + maPopupMenuRefs.push_back( aRef ); } } return aRef; |