fix resource leak when closing tabs

This commit is contained in:
Vadim Lopatin 2015-02-13 16:35:38 +03:00
parent 195a8587be
commit 7490ae0c56
3 changed files with 5 additions and 2 deletions

View File

@ -382,6 +382,7 @@ class Window {
_backgroundColor = 0xFFFFFF; _backgroundColor = 0xFFFFFF;
} }
~this() { ~this() {
debug Log.d("Destroying window");
if (_tooltip.popup) { if (_tooltip.popup) {
destroy(_tooltip.popup); destroy(_tooltip.popup);
_tooltip.popup = null; _tooltip.popup = null;

View File

@ -113,7 +113,7 @@ class StringListAdapter : ListAdapter {
override Widget itemWidget(int index) { override Widget itemWidget(int index) {
updateStatesLength(); updateStatesLength();
if (_widget is null) { if (_widget is null) {
_widget = new TextWidget("LIST_ITEM"); _widget = new TextWidget("STRING_LIST_ITEM");
_widget.styleId = STYLE_LIST_ITEM; _widget.styleId = STYLE_LIST_ITEM;
} else { } else {
if (index == _lastItemIndex) if (index == _lastItemIndex)

View File

@ -332,7 +332,9 @@ class TabControl : WidgetGroupDefaultDrawing {
} }
int index = _items.indexById(id); int index = _items.indexById(id);
if (index >= 0) { if (index >= 0) {
_children.remove(index + 1); Widget w = _children.remove(index + 1);
if (w)
destroy(w);
_items.remove(index); _items.remove(index);
if (id.equal(_selectedTabId)) if (id.equal(_selectedTabId))
_selectedTabId = null; _selectedTabId = null;