Memory leak with Form Validator
Added by Boris N over 14 years ago
Code:
username = new Wt::WLineEdit();
username->setValidator(new Wt::WRegExpValidator("[a-zA-Z][a-zA-Z0-9._-]{2,29}"));
I created my own class Register_widget (inherited from WContainerWidget), that has username as field
username is linked to Register_widget.
Then I test this Register_widget:
Register_widget *r;
int i = 0;
for (i=0; i<10000; i)
{
r = new Register_widget();
delete r;
}
There are memory leaks
When I test it without WRegExpValidator - there are no memory leaks
Replies (1)
RE: Memory leak with Form Validator - Added by Koen Deforche over 14 years ago
Hey Boris,
You're quite right. I've fixed it in git (ownership of the WValidator should be transferred to the widget it is set, unless it already has a parent).
Regards,
koen