diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-20 05:08:19 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-20 05:08:19 +0100 |
commit | e909fb2179724b5619213520ca46cc31b4e6713b (patch) | |
tree | b80edd2db67783d9a44a0dc45ffbe7e0baef20fb /src/qregisters.h | |
parent | f843a090cdda120d58f968b7936bdcc53b61e323 (diff) | |
download | sciteco-e909fb2179724b5619213520ca46cc31b4e6713b.tar.gz |
Throw error when a macro terminates while a local q-reg is edited.
This is only a problem if the macro created the local Q-Register table
(i.e. not when called with ":M") but resulted in segfaults.
Since we do not want to save in a Q-Reg whether it is local
(and that wouldn't suffice anyway), we do it in the Q-Register table
cleanup. The corresponding QRegisterTable::clear() must be called
explicitly, since the RBTree::clear() called on destruction does not
and cannot throw errors.
If QRegisterTable::clear() has been called successfully, the default object
destructor will not do much. If it has thrown an error, the destructor
will clean up the remaining Q-Registers.
Diffstat (limited to 'src/qregisters.h')
-rw-r--r-- | src/qregisters.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qregisters.h b/src/qregisters.h index efd802d..cf2c644 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -165,7 +165,7 @@ public: void edit(void); }; -class QRegisterTable : public RBTree { +class QRegisterTable : private RBTree { class UndoTokenRemove : public UndoToken { QRegisterTable *table; QRegister *reg; @@ -236,6 +236,8 @@ public: edit(reg); return reg; } + + void clear(void); }; class QRegisterStack { |