@@ -196,6 +196,7 @@ void LCUI_InitWidgetEvent(LCUI_WidgetEvent e, const char *name)
196
196
static void Widget_AddEventRecord (LCUI_Widget widget , LCUI_WidgetEventPack pack )
197
197
{
198
198
WidgetEventRecord record ;
199
+
199
200
LCUIMutex_Lock (& self .mutex );
200
201
record = RBTree_CustomGetData (& self .event_records , widget );
201
202
if (!record ) {
@@ -215,6 +216,7 @@ static int Widget_DeleteEventRecord(LCUI_Widget widget,
215
216
int ret = 0 ;
216
217
WidgetEventRecord record ;
217
218
LinkedListNode * node , * prev ;
219
+
218
220
LCUIMutex_Lock (& self .mutex );
219
221
record = RBTree_CustomGetData (& self .event_records , widget );
220
222
if (!record ) {
@@ -238,6 +240,7 @@ static void WidgetEventTranslator(LCUI_Event e, LCUI_WidgetEventPack pack)
238
240
{
239
241
WidgetEventHandler handler = e -> data ;
240
242
LCUI_Widget w = pack -> widget ;
243
+
241
244
if (!w ) {
242
245
return ;
243
246
}
@@ -641,6 +644,10 @@ int Widget_StopEventPropagation(LCUI_Widget widget)
641
644
LinkedListNode * node ;
642
645
WidgetEventRecord record ;
643
646
LCUI_WidgetEventPack pack ;
647
+
648
+ if (self .event_records .total_node <= 1 ) {
649
+ return 0 ;
650
+ }
644
651
LCUIMutex_Lock (& self .mutex );
645
652
record = RBTree_CustomGetData (& self .event_records , widget );
646
653
if (!record ) {
@@ -828,6 +835,9 @@ void LCUIWidget_ClearEventTarget(LCUI_Widget widget)
828
835
WidgetEventRecord record ;
829
836
LCUI_WidgetEventPack pack ;
830
837
838
+ if (self .event_records .total_node <= 1 ) {
839
+ return ;
840
+ }
831
841
LCUIMutex_Lock (& self .mutex );
832
842
record = RBTree_CustomGetData (& self .event_records , widget );
833
843
if (record ) {
@@ -1198,6 +1208,10 @@ int Widget_SetTouchCapture(LCUI_Widget w, int point_id)
1198
1208
int Widget_ReleaseTouchCapture (LCUI_Widget w , int point_id )
1199
1209
{
1200
1210
int ret ;
1211
+
1212
+ if (self .touch_capturers .length <= 1 ) {
1213
+ return 0 ;
1214
+ }
1201
1215
LCUIMutex_Lock (& self .mutex );
1202
1216
ret = TouchCapturers_Delete (& self .touch_capturers , w , point_id );
1203
1217
LCUIMutex_Unlock (& self .mutex );
0 commit comments