r0x0r/pywebview

before_show callback not synchronous

Closed this issue · 3 comments

Specification

  • pywebview version: 5.3.2
  • operating system: Windows
  • web renderer: WinForms/Chromium

Description

I love the new before_show Event to set attributes before the window is actually shown. Unfortunately this only works if I set this manually:

my_window.events.before_show._should_lock = True

Otherwise there are unpredictable race conditions due to the new thread where my callback is executed. In fact most attributes have to be set before the window is shown so I think it has to be synchronous here.

Possible solutions: Creating the Event with this flag per default or at least make the "_should_lock" a part of the public api and document it.

Practicalities

  • NO I am not willing to work on this issue myself.

  • NO I am not prepared to support this issue financially.

I agree making the before_show blocking by default makes sense. It is a simple change, but must be tested for each platform first.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.