diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-18 12:32:16 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-18 12:32:16 +0200 |
commit | b7b98405089e69dfae0fc11e2a423860f50756e9 (patch) | |
tree | b789182370dc4493d040dafb0bc932f69fbbd3c4 /src/qreg.c | |
parent | dc417a890ad48e28e573770f2ae980af002e93cb (diff) | |
download | sciteco-b7b98405089e69dfae0fc11e2a423860f50756e9.tar.gz |
check that local register is not edited at the end of macro calls
* This was unsafe and could easily result in crashes, since teco_qreg_current
would afterwards point to an already freed Q-Register.
* Since automatically editing another register or buffer is not easy to do right,
we throw an error instead.
Diffstat (limited to 'src/qreg.c')
-rw-r--r-- | src/qreg.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1160,6 +1160,12 @@ teco_ed_hook(teco_ed_hook_t type, GError **error) if (!teco_qreg_execute(qreg, &locals, error)) goto error_add_frame; + if (teco_qreg_current && !teco_qreg_current->must_undo) { + /* currently editing local Q-Register */ + teco_error_editinglocalqreg_set(error, teco_qreg_current->head.name.data, + teco_qreg_current->head.name.len); + goto error_add_frame; + } return teco_expressions_discard_args(error) && teco_expressions_brace_close(error); |