Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Windows: Prevent platform thread from deadlocking during window resize #33478

Merged
merged 1 commit into from
May 19, 2022

Conversation

abnemo
Copy link
Contributor

@abnemo abnemo commented May 19, 2022

Fixes flutter/flutter#77034

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on
    writing and running engine tests.
  • I signed the [CLA].
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).

@google-cla
Copy link

google-cla bot commented May 19, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@abnemo abnemo force-pushed the fix-win32-window-resize-deadlock branch from 17cb2ef to ca2d2b1 Compare May 19, 2022 09:11
@abnemo abnemo closed this May 19, 2022
@abnemo abnemo reopened this May 19, 2022
@abnemo abnemo marked this pull request as ready for review May 19, 2022 09:22
@abnemo abnemo marked this pull request as draft May 19, 2022 09:30
@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

@abnemo abnemo marked this pull request as ready for review May 19, 2022 09:47
@abnemo abnemo force-pushed the fix-win32-window-resize-deadlock branch from ca2d2b1 to 3dc7e46 Compare May 19, 2022 09:49
@jnschulze jnschulze self-requested a review May 19, 2022 09:56
@jnschulze
Copy link
Member

I was looking at the same issue a couple of days ago and assumed that it would only occur if FlutterWindowsView::OnWindowSizeChanged gets invoked before the first frame gets rendered (there was a similar issue on macOS: #22457).

However, I realized that it AFAICT only occurs when attempting to resize the window programmatically using SetWindowPos or MoveWindow.

I haven't found the root cause yet but I think having a timeout for the resize condition variable is a viable safety net.
It's definitely better than risking to block the platform thread forever.

@jnschulze
Copy link
Member

I just tested it with the example of the linked issue (flutter/flutter#77034) and can confirm that the window gets properly moved and resized without freezing the app.

@tilongzs
Copy link

Great, thanks a lot for the fix.

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice -- Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

window losing response caused by MoveWindow
4 participants