From 28ff1800bc14affb9a33b37cffe275df9379dac9 Mon Sep 17 00:00:00 2001 From: Christophe de Dinechin Date: Sat, 17 Aug 2024 12:19:51 +0200 Subject: [PATCH] ui: Keep a GC pointer in `draw_object` The `obj` pointer in `user_interface::draw_object` was not a GC pointer, but there is a `do...while` loop calling `obj->graph` that may cause a garbage collection, causing the input `obj` to be bogus. Fixes: #1115 Signed-off-by: Christophe de Dinechin --- src/user_interface.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index 2fef913f..12ee3694 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -2612,7 +2612,7 @@ bool user_interface::draw_stack() } -bool user_interface::draw_object(object_p obj, uint top, uint bottom) +bool user_interface::draw_object(object_p objp, uint top, uint bottom) // ---------------------------------------------------------------------------- // Draw the current equation or other topical object if necessary // ---------------------------------------------------------------------------- @@ -2623,6 +2623,7 @@ bool user_interface::draw_object(object_p obj, uint top, uint bottom) true); g.reduce_font(); grob_g graph = nullptr; + object_g obj = objp; do { graph = obj->graph(g);