From 30adc6971692e605c436b4d7f9ab43344aabeaad Mon Sep 17 00:00:00 2001
From: Per Hedbor <ph@opera.com>
Date: Fri, 21 Feb 2014 16:02:59 +0100
Subject: [PATCH] Avoid crashing when using threads with debug mode on

---
 src/threads.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/threads.c b/src/threads.c
index 94b9c399fa..b1e8250b69 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -619,13 +619,14 @@ PMOD_EXPORT void pike_swap_in_thread (struct thread_state *ts
 	    " unlocked: %" PRINT_CPU_TIME "\n",
 	    ts, now, ts->state.unlocked_time);
 #endif
-#ifdef PIKE_DEBUG
-    if (now < -Pike_interpreter.unlocked_time) {
-      pike_fatal_dloc("Time at swap in is before time at swap out."
-		      " %" PRINT_CPU_TIME " < %" PRINT_CPU_TIME
-		      "\n", now, -Pike_interpreter.unlocked_time);
-    }
-#endif
+/* This will not work, since Pike_interpreter_pointer is always null here... */
+/* #ifdef PIKE_DEBUG */
+/*     if (now < -Pike_interpreter.unlocked_time) { */
+/*           pike_fatal_dloc("Time at swap in is before time at swap out." */
+/*                           " %" PRINT_CPU_TIME " < %" PRINT_CPU_TIME */
+/*                           "\n", now, -Pike_interpreter.unlocked_time); */
+/*     } */
+/* #endif */
     ts->state.unlocked_time += now;
   }
 #endif
-- 
GitLab