Builder: unsaved work can be lost without a prompt, because dirty is set by published events rather than by the edit itself

Đang mở
#1,305 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
desktop, devtools

Hướng nghiên cứu

Audit undoable commands under src/viz/sgcommands and other structure-changing commands, comparing their published GeomChange, ResidueChange and LatticeChange events with the dirty flag handling in Builder::eventMCB and Builder::execute. First establish whether any current editing command omits those events; then assess whether marking successful undoable commands dirty would also affect selection, camera or display-style commands. Done means the audit identifies whether this is a live data-loss bug and whether the proposed change avoids marking non-editing commands dirty.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Found while investigating why a Builder that was never edited asks to save (#1279 W5.4).

Builder marks itself modified only on the events ResidueChange, GeomChange and LatticeChange (Builder::eventMCB), plus constraintsEdited and the script charge command. Builder::execute does NOT set the flag for a successful undoable command. Instead every editing command publishes GeomChange itself - AddFragmentCmd, DeleteCmd, CleanCmd, AtomEditCmd and the rest each do it individually.

So the flag depends on each command remembering to announce itself. Any editing command that does not publish leaves the Builder believing it is unmodified, and the user is then allowed to close it with no prompt and lose the work. There is no mechanism that would catch such an omission: nothing fails, nothing is logged, and the only symptom is work quietly disappearing.

This is the inverse of the symptom that led here. #1279 W5.4 is a Builder asking to save when nothing was edited; the same design allows a Builder not to ask when something was.

What needs establishing first: whether the hole is theoretical or actual. Audit the undoable commands under src/viz/sgcommands (and any other command that changes the structure) against the set that publishes GeomChange/ResidueChange/LatticeChange. If every current command publishes, this is a latent trap for the next command somebody writes. If any does not, it is a live data-loss bug and needs a severity to match.

Proposed fix, from the same reading: set the flag in Builder::execute when a command succeeds and is undoable, so that marking the document modified follows from editing it rather than from a separate announcement. That is roughly a one-line change, but it is a design change rather than a patch - it would want checking against commands that are undoable without being edits (selection, camera, display style), which must not mark the structure modified.

Related: #1279 (where this was found), and the cross-calculation event question in the same investigation - the Builders event receiver does not check which calculation published the event, so in one-program mode a Viewer tab may dirty a Builder tab of a different calculation.

Ngôn ngữ chính
C
Star
10
Fork
8
Merge trung bình
6 giờ 32 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FriendsofECCE/ECCE

Tất cả issue của FriendsofECCE/ECCE

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.