Skip to content

Fix hang/crash when renaming a sketch (#582) - #585

Merged
knipknap merged 1 commit into
mainfrom
fix/issue-582-sketch-rename-hang
Oct 18, 2026
Merged

knipknap merged 1 commit into
mainfrom
fix/issue-582-sketch-rename-hang

Conversation

@knipknap

Copy link
Copy Markdown
Contributor

Fixes #582

Problem

Renaming a sketch from the layer column hung the application:

  • Double-clicking a word inside the open rename entry froze the app in an
    endless stream of Gtk-CRITICAL assertion failures
    (gtk_widget_get_parent / gtk_widget_set_focus_child /
    gtk_widget_unset_state_flags), exactly as in the reporter's debug log.

Root cause

LayerColumn installs its click gesture in the capture phase, so it
sees every click inside the column before the widgets in the rows do. A
double click on a workpiece row is treated as row activation and, for
sketch workpieces, opens the sketch editor:

_on_column_clicked → _on_workpiece_double_clicked →
edit_item_requested → enter_sketch_mode → set_sketch →
open_modal_page("sketch")

Because the capture-phase gesture fires even when the double click landed
on the rename Gtk.Entry itself, the double click meant to select a
word in the rename editor instead switched the main window to the sketch
page. That hides the bottom panel containing the focused rename entry in
the middle of an active click sequence, and GTK's focus handling spins on
the torn-down widget.

The crash log confirms the chain: SketchStudio.set_sketch is invoked
immediately before the assertion-failure storm begins.

Fix

  • WorkpieceRow and GroupRow get an is_renaming() helper.
  • LayerColumn._on_column_clicked returns early when the clicked row's
    in-place name editor is open. The event is left to the entry, so
    clicking and double-clicking inside the rename editor no longer change
    the canvas selection or open the sketch editor, while rename commit
    (Enter), cancel (Escape), and click-outside-to-commit behavior are
    unchanged.

Testing

  • New regression tests in tests/ui_gtk/doceditor/test_layer_column_rename.py:
    • double-click inside the open rename entry does not emit
      edit_item_requested,
    • single click inside the entry does not emit select_items_requested,
    • double-click on a row that is not renaming still opens the sketch
      editor (guard does not over-block).
  • pixi run lint passes; pixi run uitest tests/ui_gtk/doceditor
    (103 passed) and pixi run test tests/core (929 passed).

Double-clicking a word inside a sketch's rename entry opened the
sketch editor: the layer column's capture-phase click gesture treated
the click as a row activation and switched the window to the sketch
page, hiding the bottom panel that held the focused rename entry
mid-event. GTK then spun in focus-handling assertion failures,
hanging the application (issue #582).

The column's click handler now returns early when the clicked row's
in-place name editor is open, leaving the event to the entry.
@knipknap
knipknap merged commit 80c4fb2 into main Oct 18, 2026
35 checks passed
@github-actions

Copy link
Copy Markdown

🤖 Estimated LLM implementation cost

Replayed each of the 1 commits in this pull request and counted the code lines each commit added or rewrote:

Commit Message Lines (add/rewrite) Est. output tokens Est. output cost
bbd2ce7f fix(ui): ignore layer column clicks while a row is being renamed 86 / 0 860 $0.0129
Total 86 860 $0.0129

Added lines by language: Python 86

Full estimate

Component Est. tokens Est. cost
Code emission (86 add/rewrite lines) 860 $0.0129
Context input (reading touched files) 9,059 $0.0272
Conversation replay (≈15× output) 12,900 $0.0387
Prompting (pull request description) 400 $0.0012
Lower bound (output only) 860 $0.0129
Best estimate 23,219 $0.0800

Cost model: ≈10 tokens per code line at $15/Mtok output and $3/Mtok input (assuming heavy prompt caching); input ≈ 15× output for conversation replay; a review round ≈ 42,000 tokens; a failed CI run ≈ 21,000 tokens; file reads capped at 20 kB each.

Active window from first commit to merge: <1 day.

⚠️ Caveat: the lower bound covers only the tokens for emitting the code. The best estimate adds modeled overhead for exploration, conversation replay, review and debug turns, but real sessions vary by tool and task — treat it as an order-of-magnitude figure. Human engineering time is not included.

This branch was successfully deployed

1 active deployment
pypi — bbd2ce7f Deployed Oct 18, 2026 by knipknap via Build and Publish Wheel #2385
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.

Renaming a Sketch Results in Hang/Crash

1 participant