Skip to content

fix: stop a click beside an object from deadlocking the window - #16

Merged
mameen merged 2 commits into
AlienTechSoftware:mainfrom
tanmaysinghx:fix/issue-15-preview-lock-deadlock
Oct 30, 2026
Merged

mameen merged 2 commits into
AlienTechSoftware:mainfrom
tanmaysinghx:fix/issue-15-preview-lock-deadlock

Conversation

@tanmaysinghx

Copy link
Copy Markdown
Contributor

A click on the row of a formula, diagram or picture, beside the object itself, lands on the row's own response. show_block_zoomed read that response's double_clicked() inside ui.data_mut, and in egui 0.36 double_clicked() calls ctx.input, which takes the context lock that data_mut already holds. The lock is not re-entrant, so the window froze; a debug build panics after 10s with "Failed to acquire RwLock write after 10s. Deadlock?".

Read double_clicked before data_mut, as clicked already was. The new UI test clicks beside a display formula; without the fix it fails with the same epaint panic as the report.

Fixes #15

What and why

Quality level L3 (see SKILLS/nc-devx/SKILL.md)

  • The branch is rebased on main and has no merge commits (the pre-push hook checks this)
  • cargo xtask ci passes (the pre-push hook and CI run it)
  • Coverage: the coverage job's warnings are read; cargo xtask coverage --update is in
    this pull request if coverage rose
  • Docs match the change: docs/commands.md (regenerated), docs/gaps.md,
    docs/testing.md, docs/mcp.md, docs/control-protocol.md, as they apply
  • A new user action is a CommandSpec with a test
  • Page or demo changes: cargo xtask demo-check, the format parity test, and a side by
    side look at both formats
  • UI changes: the pictures were looked at; cargo xtask screenshots if they changed
  • New files under assets/ or docs/images/ have a row in ATTRIBUTION.md

How it was checked

A click on the row of a formula, diagram or picture, beside the object
itself, lands on the row's own response. `show_block_zoomed` read that
response's `double_clicked()` inside `ui.data_mut`, and in egui 0.36
`double_clicked()` calls `ctx.input`, which takes the context lock that
`data_mut` already holds. The lock is not re-entrant, so the window froze;
a debug build panics after 10s with "Failed to acquire RwLock write after
10s. Deadlock?".

Read `double_clicked` before `data_mut`, as `clicked` already was. The new
UI test clicks beside a display formula; without the fix it fails with the
same epaint panic as the report.

Fixes AlienTechSoftware#15

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mathew-D

Copy link
Copy Markdown

I just checked out your branch and it does fix the panic I was getting in #15

@mameen mameen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fix ❤

@mameen
mameen merged commit efa23c9 into AlienTechSoftware:main Oct 30, 2026
3 checks passed
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.

Linux: DEBUG PANIC: Failed to acquire RwLock write after 10s. Deadlock?

3 participants