lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Really 'delete' what wxMenuBar::Remove() returns?


From: Greg Chicares
Subject: [lmi] Really 'delete' what wxMenuBar::Remove() returns?
Date: Mon, 28 May 2007 22:32:38 +0000
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

http://cvs.savannah.gnu.org/viewvc/lmi/lmi/main_wx.cpp?r1=1.74&r2=1.75

I'm troubled by this line that I recently wrote:
  delete menu_bar.Remove(test_menu_index);
To 'delete' anything I didn't create with 'new' myself
just seems so unusual that I'd like to ask the experts,
even though I'm pretty sure that's what the manual means:

  http://www.wxwidgets.org/manuals/stable/wx_wxmenubar.html#wxmenubarremove

"returns the menu object - the caller is responsible for deleting it."

I assume that C++'s 'delete' is meant: I can't find an
applicable Delete() in wx.

The whole menubar, BTW, comes from a wxxrc resource.
Typically I call wxXmlResource::LoadMenuBar() several
times to get equivalent menubars from the same resource,
and 'delete' this menu on each one. I have not observed
any problem.

Would it make sense to add a companion function
wxMenuBar::Destroy(), just as class wxMenu has Destroy()
as well as Remove()?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]