From: Benedikt Grundmann To: lablgtk at kaba.or.jp Subject: BUG report Date: Fri, 13 Feb 2004 00:09:50 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402130009.50474.Benedikt-Grundmann at web.de> Sender: Benedikt-Grundmann at web.de Hello folks, I discovered a bug in the Text widget binding concerning selection handling: CAMLprim value ml_gtk_text_buffer_get_selection_bounds(value tb) { CAMLparam1(tb); CAMLlocal2(res,couple); GtkTextIter res1,res2; int e; e=gtk_text_buffer_get_selection_bounds(GtkTextBuffer_val(tb), &res1, &res2); if (e) res = Val_unit; else { couple = alloc_tuple(2); Store_field(res,0,Val_GtkTextIter(&res1)); Store_field(res,1,Val_GtkTextIter(&res2)); res = ml_some(couple); }; CAMLreturn(res); } This code obviously implements a primitive of type text_buffer -> (iter * iter) option. But looking in gtkText.ml and gText.mli/gText.ml I was surprised to find out that it's declared as text_buffer -> iter * iter therefore resulting in an segmentation fault whenever one uses calls buffer#selection_bounds!! I fixed the type declarations and changed the implementation in gText.ml to this: method selection_bounds = Gaux.may_map ~f:(fun (start, stop) -> (new iter start, new iter stop)) (Buffer.get_selection_bounds obj) Surprisingly I still get a sigsev but only when I call it when NO selection is active! Any ideas? Cheers, Bene