From: Olivier Andrieu Message-ID: <16133.38310.236313.811705 at akasha.ijm.jussieu.fr> Date: Fri, 4 Jul 2003 16:56:38 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vXVum4nOuQ" Content-Transfer-Encoding: 7bit To: Richard Jones Cc: lablgtk at kaba.or.jp Subject: Re: drawable#gc_values: segmentation fault In-Reply-To: <16133.36230.879427.900061 at akasha.ijm.jussieu.fr> References: <20030704132350.GA27526 at redhat.com> <16133.36230.879427.900061@akasha.ijm.jussieu.fr> --vXVum4nOuQ Content-Type: text/plain; charset=us-ascii Content-Description: message body and .signature Content-Transfer-Encoding: 7bit Olivier Andrieu [Friday 4 July 2003] : > > Richard Jones [Friday 4 July 2003] : > > > > $ ocaml -I +lablgtk lablgtk.cma gtkInit.cmo > > Objective Caml version 3.06 > > > > # let window = GWindow.window ();; val window : GWindow.window = > > let area = GMisc.drawing_area ~packing:window#add ();; val > > area : GMisc.drawing_area = area#misc#realize ();; : unit > > = () let drawable = new GDraw.drawable area#misc#window;; val > > drawable : [ `window] GDraw.drawable = window#show ();; : > > unit = () drawable#gc_values;; Segmentation fault > quits at this point> > > Looks like a copy-n-paste bug. Does the attached patch fix the > segfault ? Oops, no it doesn't. This one you should be ok. [ Note that `alloc' does not store a None value by default, rather it fills the block with 0 (and not Val_int(0)) ] -- Olivier --vXVum4nOuQ Content-Type: text/plain Content-Disposition: attachment Content-Transfer-Encoding: 7bit --- ml_gdk.c.~1.73.~ 2003-06-25 11:32:02.000000000 +0200 +++ ml_gdk.c 2003-07-04 16:50:40.000000000 +0200 @@ -550,20 +550,28 @@ tmp = ml_some(Val_GdkFont(values.font)); Store_field(ret, 2, tmp); } + else + Store_field(ret, 2, Val_int(0)); Field(ret,3) = Val_function_type(values.function); Field(ret,4) = Val_fill(values.fill); if (values.tile) { tmp = ml_some(Val_GdkPixmap(values.tile)); Store_field(ret, 5, tmp); } - if (values.tile) { + else + Store_field(ret, 5, Val_int(0)); + if (values.stipple) { tmp = ml_some(Val_GdkPixmap(values.stipple)); Store_field(ret, 6, tmp); } - if (values.tile) { + else + Store_field(ret, 6, Val_int(0)); + if (values.clip_mask) { tmp = ml_some(Val_GdkPixmap(values.clip_mask)); Store_field(ret, 7, tmp); } + else + Store_field(ret, 7, Val_int(0)); Field(ret,8) = Val_subwindow_mode(values.subwindow_mode); Field(ret,9) = Val_int(values.ts_x_origin); Field(ret,10) = Val_int(values.ts_y_origin); --vXVum4nOuQ--