Memory leak with WMenu
Added by Ezra Buehler over 11 years ago
Hi,
I need some help with following code which is very similar to the Menu example in the Widget Gallery.
Wt::WContainerWidget* container = new Wt::WContainerWidget(root());
// Create a stack where the contents will be located.
Wt::WStackedWidget* contents = new Wt::WStackedWidget();
Wt::WMenu* menu = new Wt::WMenu(contents);
// Add menu items using the default lazy loading policy.
menu->addItem("1", new MyText("one"));
menu->addItem("2", new MyText("two"));
container->addWidget(contents);
container->addWidget(menu);
The problem I found was that MyText("two")
is not cleaned up when the session is destroyed. After a long debugging session I figured out that I have to add menu
before contents
and it will work fine. What is happening exactly and is this behavior intended?
Cheers,
Ezra.
Replies (2)
RE: Memory leak with WMenu - Added by Koen Deforche over 11 years ago
Hey Ezra,
That seems a bug indeed (I guess it's not common to have the menu after the contents). Can you file it as a bug ticket?
Regards,
koen