Files
oak-gpui/crates
张小白andshenjackyuanjie 6af385c09e windows: Fix some weird IME window panic (#15286)
Previously, we used messages greater than `WM_USER` to pass information
between `WindowsPlatform` and `WindowsWindow`. For example, to close a
window, we handled it as follows:
1. The window sends a message with `WM_USER + 2` to `WindowsPlatform`.
2. `WindowsPlatform`, upon receiving this message, casts the `lparam` to
`HWND` and closes the window.

According to Microsoft's documentation, it is safe to use values between
`WM_USER` and `0xBFFF` as messages. However, certain versions of
Microsoft's IME use `WM_USER + 2` for UNKNOWN purposes. This causes step
2 to be erroneously triggered. The IME window's `lparam` value could be
arbitrary, leading to an attempt to close an arbitrary `HWND` and
resulting in errors.

It is quite surprising that Microsoft indicates using `WM_USER + 2` is
safe, yet Microsoft itself breaks this convention. I mean, well done
Microsoft!

This PR addresses the issue by using the `wparam` with a specific random
value for validation purpose when sending the aforementioned message.
Before `WindowsPlatform` attempts to close the window, it will first
verify the `wparam` value.

Special thanks to @shenjackyuanjie for helping me on this.


Co-authored-by: shenjackyuanjie <3695888@qq.com>


Release Notes:

- Fixed weird panic when IME window is closing(#15185, #12563).

---------

Co-authored-by: shenjack <3695888@qq.com>
2024-07-26 17:40:55 -07:00
..
2024-07-23 15:01:05 -07:00
2024-07-26 16:42:21 -07:00
2024-05-29 18:06:45 -07:00
2024-07-23 15:01:05 -07:00
2024-07-26 03:31:41 -04:00
2024-07-26 17:58:37 -04:00
2024-07-26 16:42:21 -07:00
2024-07-26 16:42:21 -07:00
2024-07-23 15:01:05 -07:00
2024-05-29 18:06:45 -07:00
2024-04-30 23:31:59 -06:00
2024-07-23 15:01:05 -07:00
2024-03-11 10:45:57 +01:00
2024-07-26 16:42:21 -07:00
2024-07-15 17:04:15 -06:00
2024-07-25 09:00:53 -06:00
2024-07-26 16:45:44 -06:00
2024-07-26 16:45:44 -06:00
2024-07-26 16:45:44 -06:00
2024-07-26 17:40:38 -04:00
2024-07-26 17:40:38 -04:00
2024-07-26 16:42:21 -07:00
2024-07-26 16:42:21 -07:00
2024-06-21 16:32:32 -07:00
2024-07-26 03:31:41 -04:00
2024-07-26 16:42:21 -07:00
2024-07-26 16:42:21 -07:00
2024-04-15 14:21:52 +02:00
2024-07-26 16:45:44 -06:00
2024-07-26 16:45:44 -06:00
2024-07-26 16:45:44 -06:00
2024-07-26 16:45:44 -06:00