Skip to content

Pcbnew: Fix pad dialog crashes and selection loss - #1

Open
timfroh wants to merge 1 commit into
atopile/mainfrom
feature/fix-pad-preview-options-lifetime
Open

timfroh wants to merge 1 commit into
atopile/mainfrom
feature/fix-pad-preview-options-lifetime

Conversation

@timfroh

@timfroh timfroh commented Sep 21, 2026

Copy link
Copy Markdown

Description

The Pad Properties dialog has a small canvas showing a preview of the pad. Its display settings were created in a local variable during setup, but the canvas kept a reference to them after that variable was destroyed.

A graphics error in WASM triggered a rebuild of the preview renderer, which then accessed those expired settings. This broke observer registration: when a renderer was cleaned up, remove_observer could no longer find its registration and asserted.

The fix keeps the settings alive for the lifetime of the preview and destroys the canvas before releasing them.

Motivation

Double-clicking a pad could trigger the assertion. Closing Pad Properties with OK or Cancel could also leave selection unresponsive—both clicking items and dragging a selection rectangle stopped working. Both symptoms are confirmed fixed with a compiled WASM binary.

There will be a separate fix in PCBJam for the underlying graphics error that triggered renderer recovery. This PR fixes the KiCad lifetime bug that made that recovery unsafe.

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.

1 participant