aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/qreg.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-11 09:23:39 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-11 09:23:39 +0300
commitaf16d43af82ad0d05710c42232332a400614d3ea (patch)
tree5b4861c9d3ccc84ab95ebafa88340ab649e3a3d2 /src/qreg.c
parent71bf522231d2998f1fb183f343c2b1f9dbcd3b15 (diff)
downloadsciteco-af16d43af82ad0d05710c42232332a400614d3ea.tar.gz
fixed crashes when the Q-Reg stack is non-empty at exit
* Test case: sciteco -e '[a' [aEX$$ in interactive mode would also crash. * No longer use a destructor - it was executed after the Q-Reg view was destroyed. * Instead, we now explicitly call teco_qreg_stack_clear() in main(). * Added a regression test case.
Diffstat (limited to 'src/qreg.c')
-rw-r--r--src/qreg.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qreg.c b/src/qreg.c
index 5c39409..84bc217 100644
--- a/src/qreg.c
+++ b/src/qreg.c
@@ -1140,14 +1140,12 @@ teco_qreg_stack_pop(teco_qreg_t *qreg, GError **error)
return TRUE;
}
-#ifndef NDEBUG
-static void __attribute__((destructor))
+void
teco_qreg_stack_clear(void)
{
g_array_set_clear_func(teco_qreg_stack, (GDestroyNotify)teco_qreg_stack_entry_clear);
g_array_free(teco_qreg_stack, TRUE);
}
-#endif
gboolean
teco_ed_hook(teco_ed_hook_t type, GError **error)