OpenMW-CS: Touch Record option is broken
Presumably a regression from !1044 (merged).
Steps to reproduce:
- Load a plugin with base plugin in the OpenMW-CS
- Open a Lands table
- Select a record and use a Touch Record command
- Use a Redo command and then Undo
As result, the editor crashes. The problem is that with !1044 (merged) we have two unique_ptr
's which hold the same raw pointer:
// clone() returns an unique_ptr, but we pass its raw pointer to the mOld
mOld.reset(mTable.getRecord(mId).clone().get());
...
// same here
mOld.reset(mLands.getRecord(mId).clone().get());
An ownership should be released from the source pointer:
mOld = mTable.getRecord(mId).clone();
...
mOld = mLands.getRecord(mId).clone();
The problem is that with these changes the editor does not crash, but Undo and Redo do nothing. Maybe there is also something wrong with the mChanged
flag.
Edited by Andrei Kortunov