$OpenBSD: patch-src_math-equation_c,v 1.2 2011/06/15 08:26:41 jasper Exp $

From 97556066ca313d42fb7c73d136395729cd690489 Mon Sep 17 00:00:00 2001
From: Joe Marcus Clarke <marcus@freebsd.org>
Date: Wed, 15 Jun 2011 08:18:27 +0000
Subject: Fix crash running on BSD

--- src/math-equation.c.orig	Tue May 24 05:20:42 2011
+++ src/math-equation.c	Wed Jun 15 10:24:30 2011
@@ -1305,6 +1305,7 @@ void
 math_equation_solve(MathEquation *equation)
 {
     GError *error = NULL;
+    gulong stacksize = 0;
 
     g_return_if_fail(equation != NULL);
 
@@ -1326,7 +1327,16 @@ 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);
