From 7490ae0c56363177685df8401bc5a5b7c45fc985 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 13 Feb 2015 16:35:38 +0300 Subject: [PATCH] fix resource leak when closing tabs --- src/dlangui/platforms/common/platform.d | 1 + src/dlangui/widgets/lists.d | 2 +- src/dlangui/widgets/tabs.d | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d index aad1678a..5e0bd60d 100644 --- a/src/dlangui/platforms/common/platform.d +++ b/src/dlangui/platforms/common/platform.d @@ -382,6 +382,7 @@ class Window { _backgroundColor = 0xFFFFFF; } ~this() { + debug Log.d("Destroying window"); if (_tooltip.popup) { destroy(_tooltip.popup); _tooltip.popup = null; diff --git a/src/dlangui/widgets/lists.d b/src/dlangui/widgets/lists.d index 7e492d6c..94f9a8aa 100644 --- a/src/dlangui/widgets/lists.d +++ b/src/dlangui/widgets/lists.d @@ -113,7 +113,7 @@ class StringListAdapter : ListAdapter { override Widget itemWidget(int index) { updateStatesLength(); if (_widget is null) { - _widget = new TextWidget("LIST_ITEM"); + _widget = new TextWidget("STRING_LIST_ITEM"); _widget.styleId = STYLE_LIST_ITEM; } else { if (index == _lastItemIndex) diff --git a/src/dlangui/widgets/tabs.d b/src/dlangui/widgets/tabs.d index f90ef968..12071b7c 100644 --- a/src/dlangui/widgets/tabs.d +++ b/src/dlangui/widgets/tabs.d @@ -332,7 +332,9 @@ class TabControl : WidgetGroupDefaultDrawing { } int index = _items.indexById(id); if (index >= 0) { - _children.remove(index + 1); + Widget w = _children.remove(index + 1); + if (w) + destroy(w); _items.remove(index); if (id.equal(_selectedTabId)) _selectedTabId = null;