Skip to content

Commit d09a302

Browse files
committed
fix: 修复 TextBlockHelper 的内存泄露
1 parent fa5159f commit d09a302

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎src/Magpie/TextBlockHelper.cpp‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,12 @@ void TextBlockHelper::_OnIsAutoTooltipChanged(DependencyObject const& sender, De
3535
_SetTooltipBasedOnTrimmingState(sender.as<TextBlock>(), true);
3636
});
3737
tb.RegisterPropertyChangedCallback(
38-
tb.TextProperty(),
39-
[](DependencyObject const& sender, DependencyProperty const&) -> fire_and_forget {
40-
TextBlock tb = sender.as<TextBlock>();
38+
TextBlock::TextProperty(),
39+
[](DependencyObject const& sender, DependencyProperty const&) {
4140
// 等待布局更新
42-
co_await 10ms;
43-
co_await App::Get().Dispatcher().TryRunAsync(
41+
App::Get().Dispatcher().RunAsync(
4442
CoreDispatcherPriority::Low,
45-
std::bind_front(&_SetTooltipBasedOnTrimmingState, tb, true)
43+
std::bind_front(&_SetTooltipBasedOnTrimmingState, sender.as<TextBlock>(), true)
4644
);
4745
}
4846
);

0 commit comments

Comments
 (0)