summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbkma <[email protected]>2025-08-15 12:35:22 +0200
committermbkma <[email protected]>2025-08-15 12:42:29 +0200
commit4bff62e6ac8ad287f5c3ec6e93974c550e54cb0a (patch)
tree74c5815b2f63f027aea6b6ef53e22bef4b1ae79f
parentff3858a325c4d3ad172834b74f347ca9ab5dd81e (diff)
downloadmate-calc-fix/#34.tar.bz2
mate-calc-fix/#34.tar.xz
Defer reformat_separators() Using g_idle_add_once()fix/#34
Wrap the function to run after the current GTK event loop iteration, when it's safe to mutate the buffer.
-rw-r--r--src/math-equation.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/math-equation.c b/src/math-equation.c
index c7a4ef5..aa145f5 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -299,7 +299,7 @@ reformat_display(MathEquation *equation)
reformat_ans(equation);
/* Add/remove thousands separators */
- reformat_separators(equation);
+ g_idle_add_once(reformat_separators, equation);
g_signal_emit_by_name(equation, "display-changed");
}
@@ -1901,8 +1901,8 @@ insert_text_cb(MathEquation *equation,
equation->priv->state.entered_multiply = strcmp(text, "×") == 0;
/* Update thousands separators */
- reformat_separators(equation);
-
+ g_idle_add_once(reformat_separators, equation);
+
g_object_notify(G_OBJECT(equation), "display");
}
@@ -1918,7 +1918,7 @@ delete_range_cb(MathEquation *equation,
equation->priv->state.entered_multiply = FALSE;
/* Update thousands separators */
- reformat_separators(equation);
+ g_idle_add_once(reformat_separators, equation);
// FIXME: A replace will emit this both for delete-range and insert-text, can it be avoided?
g_object_notify(G_OBJECT(equation), "display");