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

Abierto
#1,305 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
c
Área
desktop, devtools

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C
Estrellas
10
Forks
8
Merge medio
6 h 32 min
PR fusionados (30 d)
1

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de FriendsofECCE/ECCE

Todos los issues de FriendsofECCE/ECCE

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.