Clarify wxMenu objects allocation rules.
Make it clear that only the menu directly passed to wxWindow::PopupMenu() doesn't need to be allocated on the heap and that its submenus still do. Closes #11851. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63771 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
7517dcb56e
commit
d16ba4644a
@ -416,9 +416,13 @@ public:
|
||||
|
||||
@section menu_allocation Allocation strategy
|
||||
|
||||
All menus except the popup ones must be created on the @b heap.
|
||||
All menus attached to a menubar or to another menu will be deleted by their
|
||||
parent when it is deleted.
|
||||
All menus must be created on the @b heap because all menus attached to a
|
||||
menubar or to another menu will be deleted by their parent when it is
|
||||
deleted. The only exception to this rule are the popup menus (i.e. menus
|
||||
used with wxWindow::PopupMenu()) as wxWidgets does not destroy them to
|
||||
allow reusing the same menu more than once. But the exception applies only
|
||||
to the menus themselves and not to any submenus of popup menus which are
|
||||
still destroyed by wxWidgets as usual and so must be heap-allocated.
|
||||
|
||||
As the frame menubar is deleted by the frame itself, it means that normally
|
||||
all menus used are deleted automatically.
|
||||
|
Loading…
Reference in New Issue
Block a user