_widgetToDestroy should be private, enlarged documentation

This commit is contained in:
and3md 2017-04-08 13:42:34 +02:00
parent a99064eb03
commit 73944287ad
2 changed files with 19 additions and 3 deletions

View File

@ -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;

View File

@ -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);