[gcalctool] Fix crash running on BSD



commit 97556066ca313d42fb7c73d136395729cd690489
Author: Joe Marcus Clarke <marcus freebsd org>
Date:   Wed Jun 15 18:18:27 2011 +1000

    Fix crash running on BSD

 NEWS                |    4 ++++
 src/math-equation.c |   11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 6702eac..97cbff6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Overview of changes in gcalctool 6.1.1
+
+    * Fix crash running on BSD (Joe Marcus Clarke, Bug #650174)
+
 Overview of changes in gcalctool 6.1.0
 
     * Fix conversion of nautical miles (Bruce Cowan, Bug #648205)
diff --git a/src/math-equation.c b/src/math-equation.c
index d12329a..0183dca 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -1301,6 +1301,7 @@ void
 math_equation_solve(MathEquation *equation)
 {
     GError *error = NULL;
+    gulong stacksize = 0;
 
     g_return_if_fail(equation != NULL);
 
@@ -1322,7 +1323,15 @@ math_equation_solve(MathEquation *equation)
 
     math_equation_set_number_mode(equation, NORMAL);
 
-    g_thread_create(math_equation_solve_real, equation, false, &error);
+    // Fix for https://bugzilla.gnome.org/show_bug.cgi?id=650174
+    // FIXME: This is a real hack, should be avoidable when parser is rewritten and doesn't require a crazy large stack
+    if (GLIB_SIZEOF_LONG == 8) {
+           stacksize = 0x400000;
+    } else {
+           stacksize = 0x200000;
+    }
+
+    g_thread_create_full(math_equation_solve_real, equation, stacksize, false, false, G_THREAD_PRIORITY_NORMAL, &error);
 
     if (error)
         g_warning("Error spawning thread for calculations: %s\n", error->message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]