fixed memory leak in TabWidget
svn-id: r11191
This commit is contained in:
parent
496d19d461
commit
767fc87148
5 changed files with 15 additions and 8 deletions
|
@ -42,6 +42,14 @@ TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
|
|||
_tabWidth = 40;
|
||||
}
|
||||
|
||||
TabWidget::~TabWidget() {
|
||||
for (int i = 0; i < _tabs.size(); ++i) {
|
||||
delete _tabs[i].firstWidget;
|
||||
_tabs[i].firstWidget = 0;
|
||||
}
|
||||
_tabs.clear();
|
||||
}
|
||||
|
||||
int16 TabWidget::getChildY() const {
|
||||
return getAbsY() + kTabHeight;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ protected:
|
|||
|
||||
public:
|
||||
TabWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||
~TabWidget();
|
||||
|
||||
virtual int16 getChildY() const;
|
||||
|
||||
|
|
|
@ -35,13 +35,7 @@
|
|||
*/
|
||||
|
||||
Dialog::~Dialog() {
|
||||
Widget *w = _firstWidget, *next;
|
||||
while (w) {
|
||||
next = w->_next;
|
||||
w->_next = 0;
|
||||
delete w;
|
||||
w = next;
|
||||
}
|
||||
delete _firstWidget;
|
||||
_firstWidget = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ Widget::Widget(GuiObject *boss, int x, int y, int w, int h)
|
|||
_boss->_firstWidget = this;
|
||||
}
|
||||
|
||||
Widget::~Widget() {
|
||||
delete _next;
|
||||
}
|
||||
|
||||
void Widget::draw() {
|
||||
NewGui *gui = &g_gui;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
public:
|
||||
Widget(GuiObject *boss, int x, int y, int w, int h);
|
||||
virtual ~Widget() {}
|
||||
virtual ~Widget();
|
||||
|
||||
virtual int16 getAbsX() const { return _x + _boss->getChildX(); }
|
||||
virtual int16 getAbsY() const { return _y + _boss->getChildY(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue