Skip to content

Embrace reentrancy#267

Merged
prokopyl merged 7 commits into
nextfrom
embrace-reentrancy
Jun 18, 2026
Merged

Embrace reentrancy#267
prokopyl merged 7 commits into
nextfrom
embrace-reentrancy

Conversation

@prokopyl

@prokopyl prokopyl commented Jun 14, 2026

Copy link
Copy Markdown
Member

This PR allows the WindowHandler's methods to be called re-entrantly, which allows for natural platform behavior on Windows and macOS.

This is done by changing the WindowHandler methods' signatures to only take &self instead of &mut self. This makes it so baseview users need to use interior mutability in their types (Cell, OnceCell, RefCell, etc.).

While this increases complexity for users, this allows for more granularity in the borrows (rather than baseview attempting to prevent reentrancy, and trying to mutably borrow the whole WindowHandler for each event).

This also allows for downstream users to perform any kind of action in any kind of handler (e.g. resizing the window on click in a menu), without having to "defer" anything.

@aidan729

Copy link
Copy Markdown

@prokopyl Any reason you are waiting to merge this into master?

@prokopyl prokopyl changed the base branch from master to next June 18, 2026 02:06
@prokopyl prokopyl force-pushed the embrace-reentrancy branch from 405de41 to 770eca8 Compare June 18, 2026 02:10
@prokopyl prokopyl changed the title Experiment: Embrace reentrancy Embrace reentrancy Jun 18, 2026
@prokopyl prokopyl marked this pull request as ready for review June 18, 2026 02:49
@prokopyl

Copy link
Copy Markdown
Member Author

@prokopyl Any reason you are waiting to merge this into master?

This is a breaking change (and a rather major one at that), so it's slated for the next major release of baseview (v0.2).

It won't be merged into master until that release is ready, but I'll merge this and other major PRs in the next branch.

@prokopyl prokopyl merged commit f3e00f8 into next Jun 18, 2026
14 checks passed
@prokopyl prokopyl deleted the embrace-reentrancy branch June 18, 2026 02:52
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.

2 participants