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

オープン
#1,305 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c
領域
desktop, devtools

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C
スター
10
フォーク
8
平均マージ
6時間 32分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FriendsofECCE/ECCE のほかの issue

FriendsofECCE/ECCE の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。