From af16d43af82ad0d05710c42232332a400614d3ea Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 11 Oct 2021 09:23:39 +0300 Subject: 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. --- src/qreg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/qreg.c') 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) -- cgit v1.2.3