Skip to content

Commit

Permalink
ui: Keep a GC pointer in draw_object
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
c3d committed Aug 17, 2024
1 parent 4524175 commit 28ff180
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/user_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ----------------------------------------------------------------------------
Expand All @@ -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);
Expand Down

0 comments on commit 28ff180

Please sign in to comment.