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

Remove most RedrawWindow to event target window #427

Merged
merged 3 commits into from
Jun 28, 2022
Merged

Remove most RedrawWindow to event target window #427

merged 3 commits into from
Jun 28, 2022

Conversation

wusyong
Copy link
Member

@wusyong wusyong commented Jun 18, 2022

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

There are two places will call lots of RedrawWindow to event target window on Windows.
This causes tauri-apps/wry#616
Do we really need to draw them despite it's always hidden?

@wusyong wusyong requested a review from a team June 18, 2022 16:14
Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

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

LGTM but I don't know if this has hidden side effects so lets keep an eye on this after it gets published.

@wusyong
Copy link
Member Author

wusyong commented Jun 20, 2022

Agree. I'll test more to see if I miss any other case

@lucasfernog
Copy link
Member

I'll make some tests on tauri.

@lucasfernog
Copy link
Member

LGTM after some basic tests.

@wusyong wusyong merged commit 5ca39af into dev Jun 28, 2022
@wusyong wusyong deleted the wm-paint branch June 28, 2022 11:02
@github-actions github-actions bot mentioned this pull request Jun 28, 2022
@AmionSky
Copy link

Might be unrelated but randomly got this error (it was a crash on startup) with tauri using this branch. Only happened once.

thread 'main' panicked at 'assertion failed: flush_paint_messages(None, &event_loop_runner)', C:\Users\csany\.cargo\git\checkouts\tao-b2c91e21b396bd53\2984537\src\platform_impl\windows\event_loop.rs:2324:7
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\app.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

@amrbashir
Copy link
Member

@AmionSky can you provide a minimal repro? Also it would be better to wait for the next tauri release which will include new version of tao and wry and will be released soon

@AmionSky
Copy link

@amrbashir Only happened once when I ran npm run tauri dev, have not happened since then. Will try the new version and keep an eye out for this error.

@AmionSky
Copy link

It's still only happens rarely but had the same issue with the new tauri release

thread 'main' panicked at 'assertion failed: flush_paint_messages(None, &event_loop_runner)', C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:2357:7
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\core\src\panicking.rs:143
   2: core::panicking::panic
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\/library\core\src\panicking.rs:48
   3: tao::platform_impl::platform::event_loop::handle_clear_event<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:2357
   4: tao::platform_impl::platform::event_loop::thread_event_target_callback<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:2057
   5: DefSubclassProc
   6: DefSubclassProc
   7: CallWindowProcW
   8: EnumChildWindows
   9: IsIconic
  10: KiUserCallbackDispatcher
  11: NtUserPeekMessage
  12: PeekMessageW
  13: PeekMessageW
  14: windows::Windows::Win32::UI::WindowsAndMessaging::PeekMessageW<windows::Windows::Win32::Foundation::HWND>
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.37.0\src\Windows\Win32\UI\WindowsAndMessaging\mod.rs:10634
  15: tao::platform_impl::platform::event_loop::flush_paint_messages::closure$0<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:757
  16: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >::owned_windows<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > >,tao::platform_impl::platform::event_
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop\runner.rs:193
  17: tao::platform_impl::platform::event_loop::flush_paint_messages<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:752
  18: tao::platform_impl::platform::event_loop::handle_clear_event<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:2357
  19: tao::platform_impl::platform::event_loop::thread_event_target_callback<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:2057
  20: DefSubclassProc
  21: DefSubclassProc
  22: CallWindowProcW
  23: DispatchMessageW
  24: windows::Windows::Win32::UI::WindowsAndMessaging::DispatchMessageW
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.37.0\src\Windows\Win32\UI\WindowsAndMessaging\mod.rs:2869
  25: tao::platform_impl::platform::event_loop::EventLoop<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >::run_return<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > >,tauri_runtime_wry::impl$49::run::closure_env$0<enum$<
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:258
  26: tao::platform_impl::platform::event_loop::EventLoop<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >::run<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > >,tauri_runtime_wry::impl$49::run::closure_env$0<enum$<tauri::
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\platform_impl\windows\event_loop.rs:212
  27: tao::event_loop::EventLoop<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > > >::run<enum$<tauri_runtime_wry::Message<enum$<tauri::EventLoopMessage> > >,tauri_runtime_wry::impl$49::run::closure_env$0<enum$<tauri::EventLoopMessage>,tauri::
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tao-0.12.0\src\event_loop.rs:177
  28: tauri_runtime_wry::impl$49::run<enum$<tauri::EventLoopMessage>,tauri::app::impl$18::run::closure_env$0<tauri_runtime_wry::Wry<enum$<tauri::EventLoopMessage> >,tauri::app::impl$19::run::closure_env$0<tauri_runtime_wry::Wry<enum$<tauri::EventLoopMessage> >,
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-runtime-wry-0.10.0\src\lib.rs:2062
  29: tauri::app::App<tauri_runtime_wry::Wry<enum$<tauri::EventLoopMessage> > >::run<tauri_runtime_wry::Wry<enum$<tauri::EventLoopMessage> >,tauri::app::impl$19::run::closure_env$0<tauri_runtime_wry::Wry<enum$<tauri::EventLoopMessage> >,tauri_utils::assets::Emb
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-1.0.1\src\app.rs:732
  30: tauri::app::Builder<tauri_runtime_wry::Wry<enum$<tauri::EventLoopMessage> > >::run<tauri_runtime_wry::Wry<enum$<tauri::EventLoopMessage> >,tauri_utils::assets::EmbeddedAssets>
             at C:\Users\csany\.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-1.0.1\src\app.rs:1567
  31: app::main
             at .\src\main.rs:10
  32: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@amrbashir
Copy link
Member

amrbashir commented Jun 30, 2022

@AmionSky thanks for reporting, we will look into it

@tance77
Copy link

tance77 commented Apr 30, 2024

@AmionSky

Just got the same error I can't reproduce it but here is the stack trace.

OS Version: windows 10.0.22631 (None)
Report Version: 104


Application Specific Information:
assertion failed: flush_paint_messages(None, &subclass_input.event_loop_runner)

Thread 0 Crashed:
0   MY_APP.exe                    0x7ff7732eb4a6      [inlined] backtrace::backtrace::dbghelp64::MyContext::ip (dbghelp64.rs:67)
1   MY_APP.exe                    0x7ff7732eb4a6      [inlined] backtrace::backtrace::dbghelp64::trace (dbghelp64.rs:102)
2   MY_APP.exe                    0x7ff7732eb4a6      [inlined] backtrace::backtrace::trace_unsynchronized (mod.rs:66)
3   MY_APP.exe                    0x7ff7732eb4a6      backtrace::backtrace::trace<T> (mod.rs:53)
4   MY_APP.exe                    0x7ff7732ea689      [inlined] backtrace::capture::Backtrace::create (capture.rs:193)
5   MY_APP.exe                    0x7ff7732ea689      backtrace::capture::Backtrace::new (capture.rs:158)
6   MY_APP.exe                    0x7ff7732e100a      sentry_backtrace::current_stacktrace (lib.rs:26)
7   MY_APP.exe                    0x7ff7732ca6a6      sentry_panic::PanicIntegration::event_from_panic_info (lib.rs:128)
8   MY_APP.exe                    0x7ff7732cd252      [inlined] sentry_panic::panic_handler::closure$0 (lib.rs:36)
9   MY_APP.exe                    0x7ff7732cd252      [inlined] sentry_core::api::with_integration::closure$0::closure$0 (api.rs:237)
10  MY_APP.exe                    0x7ff7732cd252      [inlined] sentry_core::hub::Hub::with_integration (hub.rs:82)
11  MY_APP.exe                    0x7ff7732cd252      [inlined] sentry_core::api::with_integration::closure$0 (api.rs:237)
12  MY_APP.exe                    0x7ff7732cd252      [inlined] sentry_core::hub::impl$0::with_active::closure$0 (hub.rs:58)
13  MY_APP.exe                    0x7ff7732cd252      [inlined] sentry_core::hub_impl::impl$3::with::closure$0
14  MY_APP.exe                    0x7ff7732cd252      [inlined] std::thread::local::LocalKey<T>::try_with (local.rs:286)
15  MY_APP.exe                    0x7ff7732cd252      [inlined] std::thread::local::LocalKey<T>::with (local.rs:262)
16  MY_APP.exe                    0x7ff7732cd252      sentry_core::hub::Hub::with<T> (hub_impl.rs:149)
17  MY_APP.exe                    0x7ff7732ca433      [inlined] sentry_core::hub::Hub::with_active (hub.rs:56)
18  MY_APP.exe                    0x7ff7732ca433      [inlined] sentry_core::api::with_integration (api.rs:237)
19  MY_APP.exe                    0x7ff7732ca433      [inlined] sentry_panic::panic_handler (lib.rs:35)
20  MY_APP.exe                    0x7ff7732ca433      sentry_panic::impl$1::setup::closure$0::closure$0 (lib.rs:69)
21  MY_APP.exe                    0x7ff773a5cb82      [inlined] alloc::boxed::impl$49::call (boxed.rs:2029)
22  MY_APP.exe                    0x7ff773a5cb82      std::panicking::rust_panic_with_hook (panicking.rs:785)
23  MY_APP.exe                    0x7ff773a5c9ea      std::panicking::begin_panic_handler::closure$0 (panicking.rs:651)
24  MY_APP.exe                    0x7ff773a5a718      std::sys_common::backtrace::__rust_end_short_backtrace<T> (backtrace.rs:171)
25  MY_APP.exe                    0x7ff773a5c6f5      std::panicking::begin_panic_handler (panicking.rs:647)
26  <unknown>                       0x7ff773c12227      <unknown>
27  <unknown>                       0x7ff773c12302      <unknown>
28  MY_APP.exe                    0x7ff772ea922d      [inlined] tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0 (event_loop.rs:2186)
29  MY_APP.exe                    0x7ff772ea922d      [inlined] core::ops::function::FnOnce::call_once (function.rs:250)
30  MY_APP.exe                    0x7ff772ea922d      [inlined] core::panic::unwind_safe::impl$23::call_once (unwind_safe.rs:272)
31  MY_APP.exe                    0x7ff772ea922d      [inlined] std::panicking::try::do_call (panicking.rs:554)
32  MY_APP.exe                    0x7ff772ea922d      std::panicking::try<T> (panicking.rs:518)
33  MY_APP.exe                    0x7ff7731c07a7      [inlined] std::panic::catch_unwind (panic.rs:142)
34  MY_APP.exe                    0x7ff7731c07a7      tao::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::catch_unwind<T> (runner.rs:156)
35  MY_APP.exe                    0x7ff77321f369      tao::platform_impl::platform::event_loop::thread_event_target_callback<T> (event_loop.rs:2275)
36  comctl32.dll                    0x7ffdf7d68251      CallNextSubclassProc
37  comctl32.dll                    0x7ffdf7d68036      MasterSubclassProc
38  user32.dll                      0x7ffe0c5889a0      UserCallWinProcCheckWow
39  user32.dll                      0x7ffe0c58865b      DispatchClientMessage
40  user32.dll                      0x7ffe0c593b9c      _fnDWORD
41  ntdll.dll                       0x7ffe0e6b3993      KiUserCallbackDispatch
42  win32u.dll                      0x7ffe0c181ad3      ZwUserDispatchMessage
43  user32.dll                      0x7ffe0c588543      DispatchMessageWorker
44  MY_APP.exe                    0x7ff7731c0f24      [inlined] windows::Windows::Win32::UI::WindowsAndMessaging::DispatchMessageW (mod.rs:2671)
45  MY_APP.exe                    0x7ff7731c0f24      [inlined] tao::platform_impl::platform::event_loop::flush_paint_messages::closure$0 (event_loop.rs:801)
46  MY_APP.exe                    0x7ff7731c0f24      tao::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::owned_windows<T> (runner.rs:194)
47  MY_APP.exe                    0x7ff772ea8f26      [inlined] tao::platform_impl::platform::event_loop::flush_paint_messages (event_loop.rs:783)
48  MY_APP.exe                    0x7ff772ea8f26      [inlined] tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0 (event_loop.rs:2186)
49  MY_APP.exe                    0x7ff772ea8f26      [inlined] core::ops::function::FnOnce::call_once (function.rs:250)
50  MY_APP.exe                    0x7ff772ea8f26      [inlined] core::panic::unwind_safe::impl$23::call_once (unwind_safe.rs:272)
51  MY_APP.exe                    0x7ff772ea8f26      [inlined] std::panicking::try::do_call (panicking.rs:554)
52  MY_APP.exe                    0x7ff772ea8f26      std::panicking::try<T> (panicking.rs:518)
53  MY_APP.exe                    0x7ff7731c07a7      [inlined] std::panic::catch_unwind (panic.rs:142)
54  MY_APP.exe                    0x7ff7731c07a7      tao::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::catch_unwind<T> (runner.rs:156)
55  MY_APP.exe                    0x7ff77321f369      tao::platform_impl::platform::event_loop::thread_event_target_callback<T> (event_loop.rs:2275)
56  comctl32.dll                    0x7ffdf7d68251      CallNextSubclassProc
57  comctl32.dll                    0x7ffdf7d68036      MasterSubclassProc
58  user32.dll                      0x7ffe0c5889a0      UserCallWinProcCheckWow
59  user32.dll                      0x7ffe0c58865b      DispatchClientMessage
60  user32.dll                      0x7ffe0c593b9c      _fnDWORD
61  ntdll.dll                       0x7ffe0e6b3993      KiUserCallbackDispatch
62  win32u.dll                      0x7ffe0c181ad3      ZwUserDispatchMessage
63  user32.dll                      0x7ffe0c588543      DispatchMessageWorker
64  MY_APP.exe                    0x7ff77321c234      [inlined] windows::Windows::Win32::UI::WindowsAndMessaging::DispatchMessageW (mod.rs:2671)
65  MY_APP.exe                    0x7ff77321c234      [inlined] tao::platform_impl::platform::event_loop::EventLoop<T>::run_return (event_loop.rs:264)
66  MY_APP.exe                    0x7ff77321c234      tao::platform_impl::platform::event_loop::EventLoop<T>::run<T> (event_loop.rs:218)
67  MY_APP.exe                    0x7ff7731d7671      [inlined] tao::event_loop::EventLoop<T>::run (event_loop.rs:179)
68  MY_APP.exe                    0x7ff7731d7671      [inlined] tauri_runtime_wry::impl$49::run (lib.rs:2302)
69  MY_APP.exe                    0x7ff7731d7671      tauri::app::App<T>::run<T> (app.rs:868)
70  MY_APP.exe                    0x7ff772ff31f4      MY_APP::main (main.rs:427)
71  MY_APP.exe                    0x7ff7730e1aa5      [inlined] core::ops::function::FnOnce::call_once (function.rs:250)
72  MY_APP.exe                    0x7ff7730e1aa5      std::sys_common::backtrace::__rust_begin_short_backtrace<T> (backtrace.rs:155)
73  MY_APP.exe                    0x7ff77300efab      [inlined] std::rt::lang_start::closure$0 (rt.rs:166)
74  MY_APP.exe                    0x7ff77300efab      [inlined] core::ops::function::FnOnce::call_once (function.rs:250)
75  MY_APP.exe                    0x7ff77300efab      core::ops::function::FnOnce::call_once<T> (rt.rs:166)
76  MY_APP.exe                    0x7ff773a4d1c1      [inlined] core::ops::function::impls::impl$2::call_once (function.rs:284)
77  MY_APP.exe                    0x7ff773a4d1c1      [inlined] std::panicking::try::do_call (panicking.rs:554)
78  MY_APP.exe                    0x7ff773a4d1c1      [inlined] std::panicking::try (panicking.rs:518)
79  MY_APP.exe                    0x7ff773a4d1c1      [inlined] std::panic::catch_unwind (panic.rs:142)
80  MY_APP.exe                    0x7ff773a4d1c1      [inlined] std::rt::lang_start_internal::closure$2 (rt.rs:148)
81  MY_APP.exe                    0x7ff773a4d1c1      [inlined] std::panicking::try::do_call (panicking.rs:554)
82  MY_APP.exe                    0x7ff773a4d1c1      [inlined] std::panicking::try (panicking.rs:518)
83  MY_APP.exe                    0x7ff773a4d1c1      [inlined] std::panic::catch_unwind (panic.rs:142)
84  MY_APP.exe                    0x7ff773a4d1c1      std::rt::lang_start_internal (rt.rs:148)
85  MY_APP.exe                    0x7ff773004d2b      main
86  MY_APP.exe                    0x7ff773bcf157      [inlined] invoke_main (exe_common.inl:78)
87  MY_APP.exe                    0x7ff773bcf157      __scrt_common_main_seh (exe_common.inl:288)
88  KERNEL32.DLL                    0x7ffe0db9257c      BaseThreadInitThunk
89  ntdll.dll                       0x7ffe0e66aa47      RtlUserThreadStart

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

Successfully merging this pull request may close these issues.

None yet

5 participants