[gnome-calculator] Fix function name crash f(x) if inputting new function name
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Fix function name crash f(x) if inputting new function name
- Date: Mon, 1 Aug 2022 05:46:13 +0000 (UTC)
commit 453d9a0bc61b94441adecf539006efc14541ec24
Author: Nathaniel Russell <naterussell83 gmail com>
Date: Mon Aug 1 00:27:40 2022 +0000
Fix function name crash f(x) if inputting new function name
fix.function-crash.patch | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
---
diff --git a/fix.function-crash.patch b/fix.function-crash.patch
new file mode 100644
index 00000000..20b3ff56
--- /dev/null
+++ b/fix.function-crash.patch
@@ -0,0 +1,46 @@
+diff -urN gnome-calculator-42.2/src/math-function-popover.vala
gnome-calculator-42.2.new/src/math-function-popover.vala
+--- gnome-calculator-42.2/src/math-function-popover.vala 2022-07-01 15:15:12.000000000 -0500
++++ gnome-calculator-42.2.new/src/math-function-popover.vala 2022-07-31 17:57:09.047423677 -0500
+@@ -24,6 +24,8 @@
+ [GtkChild]
+ private unowned Gtk.Entry function_name_entry;
+ private bool function_name_entry_placeholder_reseted = false;
++ private ulong changed_handler;
++
+
+ [GtkChild]
+ private unowned Gtk.Button add_function_button;
+@@ -35,6 +37,7 @@
+ base (equation, model, (a,b) => MathFunction.name_compare_func (a as MathFunction,b as
MathFunction));
+
+ function_list.bind_model (model, (item) => make_item_row(item as MathFunction));
++ changed_handler = function_name_entry.changed.connect (function_name_entry_changed_cb);
+
+ add_arguments_button.set_range (1, 10);
+ add_arguments_button.set_increments (1, 1);
+@@ -85,12 +88,13 @@
+ }
+ */
+
+- [GtkCallback]
+ private void function_name_entry_changed_cb (Gtk.Editable editable)
+ {
+ this.function_name_entry_placeholder_reseted = true;
+ var entry = editable as Gtk.Entry;
++ SignalHandler.block (entry, changed_handler);
+ entry.text = entry.text.replace (" ", "_");
++ SignalHandler.unblock (entry, changed_handler);
+ add_function_button.sensitive = entry.text != "";
+ }
+
+diff -urN gnome-calculator-42.2/src/ui/math-function-popover.ui
gnome-calculator-42.2.new/src/ui/math-function-popover.ui
+--- gnome-calculator-42.2/src/ui/math-function-popover.ui 2022-07-01 15:15:12.000000000 -0500
++++ gnome-calculator-42.2.new/src/ui/math-function-popover.ui 2022-07-31 17:55:03.768989873 -0500
+@@ -26,7 +26,6 @@
+ <object class="GtkEntry" id="function_name_entry">
+ <property name="placeholder_text" translatable="yes">New function</property>
+ <!--<signal name="focus" handler="function_name_focus_cb" swapped="no"/>-->
+- <signal name="changed" handler="function_name_entry_changed_cb" swapped="no"/>
+ <signal name="activate" handler="add_function_cb" swapped="no"/>
+ </object>
+ </child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]