File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,14 +121,10 @@ void LCUIWidget_ClearTrash(void)
121121
122122static void Widget_AddToTrash (LCUI_Widget w )
123123{
124- LCUI_WidgetEventRec e = { 0 };
125- e .type = LCUI_WEVENT_UNLINK ;
126124 w -> state = LCUI_WSTATE_DELETED ;
127- Widget_TriggerEvent (w , & e , NULL );
128- if (!w -> parent ) {
125+ if (Widget_Unlink (w ) != 0 ) {
129126 return ;
130127 }
131- Widget_Unlink (w );
132128 LinkedList_AppendNode (& LCUIWidget .trash , & w -> node );
133129 Widget_PostSurfaceEvent (w , LCUI_WEVENT_UNLINK , TRUE);
134130}
@@ -393,15 +389,14 @@ void Widget_ExecDestroy(LCUI_Widget widget)
393389void Widget_Destroy (LCUI_Widget w )
394390{
395391 LCUI_Widget root = w ;
392+
393+ assert (w -> state != LCUI_WSTATE_DELETED );
396394 while (root -> parent ) {
397395 root = root -> parent ;
398396 }
399397 /* If this widget is not mounted in the root widget tree */
400398 if (root != LCUIWidget .root ) {
401- LCUI_WidgetEventRec e = { 0 };
402- e .type = LCUI_WEVENT_UNLINK ;
403399 w -> state = LCUI_WSTATE_DELETED ;
404- Widget_TriggerEvent (w , & e , NULL );
405400 Widget_ExecDestroy (w );
406401 return ;
407402 }
You can’t perform that action at this time.
0 commit comments