mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Fix TextView deadlock
This commit is contained in:
parent
2d7f8295cf
commit
895557e91d
@ -114,6 +114,13 @@ impl TextContentInner {
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_cache_valid(&self, size: Vec2) -> bool {
|
||||
match self.size_cache {
|
||||
None => false,
|
||||
Some(ref last) => last.x.accept(size.x) && last.y.accept(size.y),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A simple view showing a fixed text.
|
||||
@ -273,15 +280,6 @@ impl TextView {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_cache_valid(&self, size: Vec2) -> bool {
|
||||
let content = self.content.lock().unwrap();
|
||||
|
||||
match content.size_cache {
|
||||
None => false,
|
||||
Some(ref last) => last.x.accept(size.x) && last.y.accept(size.y),
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines the way scrolling is adjusted on content or size change.
|
||||
///
|
||||
/// The scroll strategy defines how the scrolling position is adjusted
|
||||
@ -316,7 +314,7 @@ impl TextView {
|
||||
// multiple times during layout.
|
||||
fn compute_rows(&mut self, size: Vec2) {
|
||||
let mut content = self.content.lock().unwrap();
|
||||
if self.is_cache_valid(size) {
|
||||
if content.is_cache_valid(size) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user