diff --git a/src/dlangui/core/events.d b/src/dlangui/core/events.d index cf495e3d..5c3358ab 100644 --- a/src/dlangui/core/events.d +++ b/src/dlangui/core/events.d @@ -1649,9 +1649,14 @@ class RunnableEvent : CustomEvent { } } -/// queue destroy event +/** +Queue destroy event. + +This event allows delayed widget destruction and is used internally by +$(LINK2 $(DDOX_ROOT_DIR)dlangui/platforms/common/platform/Window.queueWidgetDestroy.html, Window.queueWidgetDestroy()). +*/ class QueueDestroyEvent : RunnableEvent { - Widget _widgetToDestroy; + private Widget _widgetToDestroy; this (Widget widgetToDestroy) { _widgetToDestroy = widgetToDestroy; diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d index abaa366a..399505c3 100644 --- a/src/dlangui/platforms/common/platform.d +++ b/src/dlangui/platforms/common/platform.d @@ -519,7 +519,18 @@ class Window : CustomEventTarget { destroy(_timerQueue); _eventList = null; } - /// queue destroy widget + + /** + Allows queue destroy of widget. + + Sometimes when you have very complicated UI with dynamic create/destroy lists of widgets calling simple destroy() + on widget makes segmentation fault. + + Usually because you destroy widget that on some stage call another that tries to destroy widget that calls it. + When the control flow returns widget not exist and you have seg. fault. + + This function use internally $(LINK2 $(DDOX_ROOT_DIR)dlangui/core/events/QueueDestroyEvent.html, QueueDestroyEvent). + */ void queueWidgetDestroy(Widget widgetToDestroy) { QueueDestroyEvent ev = new QueueDestroyEvent(widgetToDestroy);