[Gtkradiant] Patch undo bug in 1.4/1.6 with entities (e.g. light)

Nerius Landys nlandys at gmail.com
Mon Jan 4 15:06:46 CST 2010

> I was wondering you could be so kind and look at a small patch I came up
> with to fight an undo bug in the current and older version.
> http://github.com/mfn/GtkRadiant/commit/ee1ef98536470d5680bd9bfecc5b5c9a62ffe9ab
> It was reported to me by Nerius and, bascially, you create a light
> entity (best is you create it so that you see it also in the 3D view),
> next move it (move it so it's still visible in the 3D view, this just
> for help understanding the problem) and the undo that move (drag)
> operation. This applies to all entities which are internally handled as
> fixedsize entities.
> Without the path, the internal brush used for that entity is moved back,
> however not the light entity element itself. It turned out that due not
> updating the undoId for that brush->owner entity, the undo operation did
> not find the entity but re-created the one at the original position,
> basically the entity was duplicated in the global entity list (but only
> one had a proper brush reference though).
> I'm not sure if the fix is really *that* simple so I'd like to get some
> code comments first.

Hi, I'm Nerius, a.k.a. "Rambetter".  I tested Markus' fix with
ZeroRadiant, before and after the fix.  I tested with 4 different
kinds of entities: light, misc_model, info_player_deathmatch, and
target_speaker.  In the before case, I tried to translate (move) an
entity, then undo, then save, then close Radiant, then open the map
again.  With each of the four entity types, the problem seemed to be
slightly different in nature.  In all 4 cases the undo was severely
broken, and I think in all cases the state of the map after the undo
as seen with the editor was different from the state of the map as
saved to disk (so when you re-open the map things are suddenly in
different locations than when you still had the map open).

I then tested moving these four types of entities after Markus' fix.
I opened a map, moved an entity, did an undo, saved the map, closed
Radiant, opened the map again.  I also tested the entity delete and
undo.  With both undo move and undo delete, there were no bugs with
respect to these four types of entities.  So, as far as I can tell,
the patch fixes the bug in ZeroRadiant on Linux.

More information about the Gtkradiant mailing list