]> git.saurik.com Git - wxWidgets.git/commitdiff
Clarify wxMenu objects allocation rules.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 Mar 2010 22:39:32 +0000 (22:39 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 Mar 2010 22:39:32 +0000 (22:39 +0000)
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

interface/wx/menu.h

index ad1044dc674d70f31719e466f1b0e4d18b978945..98f2eb56ebb68e81a0962f0cc81fae6a3b5d1a2d 100644 (file)
@@ -416,9 +416,13 @@ public:
 
     @section menu_allocation Allocation strategy
 
 
     @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.
 
     As the frame menubar is deleted by the frame itself, it means that normally
     all menus used are deleted automatically.