Skip to content

Commit

Permalink
fix(core): use EventLoopProxy to prevent set_size freeze closes #3990 (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Apr 30, 2022
1 parent de444b1 commit 8f259f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-set-size-freeze.md
@@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch
---

Fixes a freeze when calling `set_size` in the main thread on Windows.
13 changes: 9 additions & 4 deletions core/tauri-runtime-wry/src/lib.rs
Expand Up @@ -1388,10 +1388,15 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
}

fn set_size(&self, size: Size) -> Result<()> {
send_user_message(
&self.context,
Message::Window(self.window_id, WindowMessage::SetSize(size)),
)
// NOTE: set_size cannot use the `send_user_message` function because tao freezes on Windows
self
.context
.proxy
.send_event(Message::Window(
self.window_id,
WindowMessage::SetSize(size),
))
.map_err(|_| Error::FailedToSendMessage)
}

fn set_min_size(&self, size: Option<Size>) -> Result<()> {
Expand Down

0 comments on commit 8f259f4

Please sign in to comment.