@@ -60,7 +60,6 @@ typedef struct LCUI_TextViewRec_ {
60
60
wchar_t * content ;
61
61
LCUI_BOOL trimming ;
62
62
LCUI_Widget widget ;
63
- LCUI_Mutex mutex ;
64
63
LCUI_TextLayer layer ;
65
64
LCUI_CSSFontStyleRec style ;
66
65
LinkedListNode node ;
@@ -79,7 +78,6 @@ typedef struct LCUI_TextViewRec_ {
79
78
static struct LCUI_TextViewModule {
80
79
int key_word_break ;
81
80
LinkedList list ;
82
- LCUI_Mutex mutex ;
83
81
LCUI_WidgetPrototype prototype ;
84
82
} self ;
85
83
@@ -266,7 +264,6 @@ static void TextView_OnInit(LCUI_Widget w)
266
264
TextLayer_SetUsingStyleTags (txt -> layer , TRUE);
267
265
Widget_BindEvent (w , "resize" , TextView_OnResize , NULL , NULL );
268
266
CSSFontStyle_Init (& txt -> style );
269
- LCUIMutex_Init (& txt -> mutex );
270
267
txt -> node .data = txt ;
271
268
txt -> node .prev = txt -> node .next = NULL ;
272
269
LinkedList_AppendNode (& self .list , & txt -> node );
@@ -287,14 +284,12 @@ static void TextView_ClearTasks(LCUI_Widget w)
287
284
static void TextView_OnDestroy (LCUI_Widget w )
288
285
{
289
286
LCUI_TextView txt = GetData (w );
287
+
288
+ LinkedList_Unlink (& self .list , & txt -> node );
290
289
CSSFontStyle_Destroy (& txt -> style );
291
290
TextLayer_Destroy (txt -> layer );
292
- LCUIMutex_Unlock (& txt -> mutex );
293
291
TextView_ClearTasks (w );
294
292
free (txt -> content );
295
- LCUIMutex_Lock (& self .mutex );
296
- LinkedList_Unlink (& self .list , & txt -> node );
297
- LCUIMutex_Unlock (& self .mutex );
298
293
}
299
294
300
295
static void TextView_AutoSize (LCUI_Widget w , float * width , float * height )
@@ -357,14 +352,12 @@ static void TextView_OnTask(LCUI_Widget w)
357
352
LinkedList_Init (& rects );
358
353
i = TASK_SET_TEXT ;
359
354
if (txt -> tasks [i ].is_valid ) {
360
- LCUIMutex_Lock (& txt -> mutex );
361
355
txt -> tasks [i ].is_valid = FALSE;
362
356
TextLayer_SetTextW (txt -> layer , txt -> tasks [i ].text , NULL );
363
357
txt -> tasks [TASK_UPDATE ].is_valid = TRUE;
364
358
txt -> tasks [TASK_UPDATE_SIZE ].is_valid = TRUE;
365
359
free (txt -> tasks [i ].text );
366
360
txt -> tasks [i ].text = NULL ;
367
- LCUIMutex_Unlock (& txt -> mutex );
368
361
}
369
362
i = TASK_SET_AUTOWRAP ;
370
363
if (txt -> tasks [i ].is_valid ) {
@@ -483,15 +476,13 @@ int TextView_SetTextW(LCUI_Widget w, const wchar_t *text)
483
476
}
484
477
wcstrim (newtext , text , NULL );
485
478
} while (0 );
486
- LCUIMutex_Lock (& txt -> mutex );
487
479
if (txt -> tasks [TASK_SET_TEXT ].is_valid &&
488
480
txt -> tasks [TASK_SET_TEXT ].text ) {
489
481
free (txt -> tasks [TASK_SET_TEXT ].text );
490
482
}
491
483
txt -> tasks [TASK_SET_TEXT ].is_valid = TRUE;
492
484
txt -> tasks [TASK_SET_TEXT ].text = newtext ;
493
485
Widget_AddTask (w , LCUI_WTASK_USER );
494
- LCUIMutex_Unlock (& txt -> mutex );
495
486
return 0 ;
496
487
}
497
488
@@ -547,15 +538,13 @@ size_t LCUIWidget_RefreshTextView(void)
547
538
LCUI_TextView txt ;
548
539
LinkedListNode * node ;
549
540
550
- LCUIMutex_Lock (& self .mutex );
551
541
for (LinkedList_Each (node , & self .list )) {
552
542
txt = node -> data ;
553
543
if (txt -> widget -> state != LCUI_WSTATE_DELETED ) {
554
544
Widget_UpdateStyle (txt -> widget , TRUE);
555
545
}
556
546
count += 1 ;
557
547
}
558
- LCUIMutex_Unlock (& self .mutex );
559
548
return count ;
560
549
}
561
550
@@ -575,12 +564,10 @@ void LCUIWidget_AddTextView(void)
575
564
self .prototype -> setattr = TextView_OnParseAttr ;
576
565
self .prototype -> runtask = TextView_OnTask ;
577
566
LCUI_AddCSSPropertyParser (& parser );
578
- LCUIMutex_Init (& self .mutex );
579
567
LinkedList_Init (& self .list );
580
568
}
581
569
582
570
void LCUIWidget_FreeTextView (void )
583
571
{
584
572
LinkedList_ClearData (& self .list , NULL );
585
- LCUIMutex_Destroy (& self .mutex );
586
573
}
0 commit comments