Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linux): crash on set size APIs #802

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/fix-set-size-linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": patch:bug
---

Fixes set size APIs crashing on Linux.
16 changes: 8 additions & 8 deletions src/platform_impl/linux/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ impl Window {
.to_physical(self.scale_factor.load(Ordering::Acquire) as f64)
}

fn set_size_constraints(&self) {
if let Err(e) = self.window_requests_tx.send((
self.window_id,
WindowRequest::SizeConstraints(*self.inner_size_constraints.borrow()),
)) {
fn set_size_constraints(&self, constraints: WindowSizeConstraints) {
if let Err(e) = self
.window_requests_tx
.send((self.window_id, WindowRequest::SizeConstraints(constraints)))
{
log::warn!("Fail to send size constraint request: {}", e);
}
}
Expand All @@ -398,19 +398,19 @@ impl Window {
let mut size_constraints = self.inner_size_constraints.borrow_mut();
size_constraints.min_width = size.map(|s| s.width());
size_constraints.min_height = size.map(|s| s.height());
self.set_size_constraints()
self.set_size_constraints(*size_constraints)
}

pub fn set_max_inner_size(&self, size: Option<Size>) {
let mut size_constraints = self.inner_size_constraints.borrow_mut();
size_constraints.max_width = size.map(|s| s.width());
size_constraints.max_height = size.map(|s| s.height());
self.set_size_constraints()
self.set_size_constraints(*size_constraints)
}

pub fn set_inner_size_constraints(&self, constraints: WindowSizeConstraints) {
*self.inner_size_constraints.borrow_mut() = constraints;
self.set_size_constraints()
self.set_size_constraints(constraints)
}

pub fn set_title(&self, title: &str) {
Expand Down
Loading