From 33f71654136014bac094babaaa81d91245fdd24c Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 21 Mar 2025 13:26:01 +0300 Subject: fixed rubout of Q-Register specifications * This was a regression introduced by 257a0bf128e109442dce91c4aaa1d97fed17ad1a. * The undo token that frees newly allocated teco_machine_qregspec_t must actually reset the pointer as well since any subsequent token, pushed by teco_undo_qregspec_own(), will expect a valid pointer. * Could have been done via ctx->expectqreg = NULL; teco_undo_qregspec_own(ctx->expectqreg); but using a special clear function requires less memory and is easier to understand. * Added test case. This wouldn't always crash, but should definitely show up in Valgrind. --- src/undo.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/undo.h') diff --git a/src/undo.h b/src/undo.h index 6fbb1c1..459fdb0 100644 --- a/src/undo.h +++ b/src/undo.h @@ -143,6 +143,7 @@ gpointer teco_undo_push_size(teco_undo_action_t action_cb, gsize size) * At undo-time however, it is expected to be valid. * Therefore it is crucial to set the variable afterwards or at least to nullify it. * The DELETE function may consequently have to deal with NULL pointers. + * Also, any other undo action must always leave the variable in a valid state. * * @ingroup undo_objects */ -- cgit v1.2.3