Version française
Home     About     Download     Resources     Contact us    
Browse thread
crash under macos x but not win32
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeffrey Loren Shaw <shawjef3@m...>
Subject: crash under macos x but not win32
The following works as intended in Win32 (the ui counts slowly from 0 to 5), 
but crashes in Mac OS X with "Bus Error". I'm running ocaml 3.09.3 installed 
with macports. For windows I used the Ocaml 3.09.3 MinGW binary 
distribution. 

(* looptest.ml *) 

open Tk 

let testone () =
 let top = openTk () in
 let l = Label.create top in
 let loopfun () =
   ignore
     (
	Thread.create
	  (fun () ->
	    for i=0 to 5 do
	      Thread.delay 1.;
	      Label.configure ~text:(string_of_int i) l
	    done
	  )
	  ()
     )
 in
 let b = Button.create ~text:"Run the test" ~command:loopfun top in
 pack  [l];
 pack [b];
 mainLoop ();; 

testone () 

(* end looptest.ml *) 

runs with: ocaml -I +labltk -I +threads unix.cma threads.cma labltk.cma 
looptest.ml 

Any ideas? Perhaps the following information will help, I don't know. 

Thread 3 Crashed:
0   com.tcltk.tklibrary  	0x9acead88 Tk_FreeGC + 30
1   com.tcltk.tklibrary  	0x9acbe64d TkButtonWorldChanged + 117
2   com.tcltk.tklibrary  	0x9acbed53 ConfigureButton + 1400
3   com.tcltk.tklibrary  	0x9acbf68f ButtonWidgetObjCmd + 416
4   com.tcltk.tcllibrary 	0x9ac2b2c3 TclInvokeObjectCommand + 264
5   dlllabltk.so         	0x000e294b camltk_tcl_direct_eval + 623
6   ocamlrun             	0x00012ba3 caml_interprete + 6262
7   ocamlrun             	0x0000e0ba caml_callbackN_exn + 185
8   ocamlrun             	0x0000e103 caml_callback_exn + 38
9   dllthreads.so        	0x000d73e8 caml_thread_start + 80
10  libSystem.B.dylib    	0x90024147 _pthread_body + 84 

Thread 3 crashed with X86 Thread State (32-bit):
 eax: 0x00000000  ebx: 0x9acead78  ecx: 0x0c5a9048  edx: 0x00000015
 edi: 0x01668608  esi: 0x00000000  ebp: 0xb0203838  esp: 0xb0203810
  ss: 0x0000001f  efl: 0x00010286  eip: 0x9acead88   cs: 0x00000017
  ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037