summaryrefslogtreecommitdiffstats
path: root/toolkit/source/awt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
commite3cf16e6fbf8d39cad8762f002b6db1d4f61ed36 (patch)
tree3c1753125149dcf36ba42a57f1574369e8524225 /toolkit/source/awt
parentAdding debian version 4:24.2.2-3. (diff)
downloadlibreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.tar.xz
libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.zip
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/source/awt')
-rw-r--r--toolkit/source/awt/vclxmenu.cxx23
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;