Version française
Home     About     Download     Resources     Contact us    
Browse thread
How to prevent program from crashing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: Re:Re: [Caml-list] How to prevent program from crashing

On Wed, 2007-10-31 at 00:52 -0500, Angela Zhu wrote:

> And I am sure the whole program and GUI crashes when function  
> "resetState2_4openFile"
> is called.
> I tried to catch the exception, but seems that it doesn't work.
> 
> Following is the message I got after the crashing:
> 
> 
> ************************************************************************ 
> ************************
> (acumen:4063): Gtk-CRITICAL **: _gtk_text_line_char_locate: assertion  
> `char_offs
> et >= 0' failed
> 
> Gtk-ERROR **: Char offset -1 is off the end of the line
> aborting...
> Abort trap

Yeah, this is an abort from a failed assertion in C,
so it isn't an Ocaml exception.

I don't know how GTK handles this, that is, whether there is
a way to register an error handler. You should ask
Jacques Garrigue that.. hmmm. no I'll post this to the list
because this is quite an interesting issue.

It would appear that this line in your code, which calls the
GTK binding:

 let appp = program2#buffer#get_text()

is the source of the problem, and that would be a bug in the Ocaml
library, not your code. Even if the buffer is empty, at least Ocaml
the library should handle this.


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net