Skip to content

Stop the click cycle in mouse_clicks.py snippet after the browser closes - #761

Merged
cztomczak merged 1 commit into
cztomczak:masterfrom
linesight:fix-mouse-clicks-after-close
Nov 17, 2026
Merged

cztomczak merged 1 commit into
cztomczak:masterfrom
linesight:fix-mouse-clicks-after-close

Conversation

@linesight

Copy link
Copy Markdown
Contributor

Fixes #711

mouse_clicks.py keeps rescheduling delayed click tasks. A task already posted when the window closes still runs inside cef.Shutdown(), after OnBeforeClose has destroyed the browser, and raises CefBrowser was destroyed.

OnBeforeClose now sets a flag, and the tasks return early when it is set.

…ses (cztomczak#711)

The snippet's delayed tasks reschedule each other and keep a reference
to the browser. A task that was already posted can still run after the
window has been closed (it runs while cef.Shutdown() pumps the message
loop), at which point the browser is destroyed and
SendMouseMoveEvent() raises "CefBrowser was destroyed".

Set a flag in LifespanHandler.OnBeforeClose and have the tasks return
without clicking or rescheduling once it is set.
@cztomczak

Copy link
Copy Markdown
Owner

Thanks.

@cztomczak
cztomczak merged commit 67070c7 into cztomczak:master Nov 17, 2026
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.

Mouse clicks snippet: delayed tasks use the browser after it is closed

2 participants