Re: RE : Segfault when removing or setting an invalid GTree.iter

View: New views
2 Messages — Rating Filter:   Alert me  

Re: RE : Segfault when removing or setting an invalid GTree.iter

by Guillaume Brunerie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

But shouldn't LablGTK raise an exception when a GTree.iter invalid is going to be used?
If I add the line :
Glib.Message.set_always_fatal [ `CRITICAL; `ERROR; `FLAG_FATAL; `FLAG_RECURSION];;
the program stops, but I can't catch nothing with a "try ... with ..." constructor.


2008/8/3 MONATE Benjamin 205998 <Benjamin.MONATE@...>
Hi Guillaume,

You program is breaking Gtk invariants hence the "Gtk-CRITICAL" message: GTree.iter cannot be used if Gtk has decided they are invalid.
Gtk is by defaul a little sloppy about ctitical errors. It just displays the messsages and goes on even if an internal later segfault may occur.
If you want your program to stop you may add to the start of bug.ml:
Glib.Message.set_always_fatal [ `CRITICAL; `ERROR; `FLAG_FATAL; `FLAG_RECURSION];;


Benjamin Monate



_______________________________________________
Lablgtk mailing list
Lablgtk@...
http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk

REĀ : Segfault when removing or setting an invalid GTree.iter

by MONATE Benjamin 205998 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

> But shouldn't LablGTK raise an exception when a GTree.iter invalid is going
> to be used?

First, Gtk does not give any warranty that a critical error will be emitted before accessing an invalid iterator.
Second, the message is tiggered in the middle of a C function of Gtk. No exception can be raised properly from this context without changing the source of Gtk itself. The same problem exists with callbacks raising exceptions.
You may want to play with
Glib.Message.set_log_handler
  ~domain:"Gtk"
  ~levels:[ `CRITICAL] (fun ~level s -> prerr_endline s; exit 1);;
but any raised exception will be ignored.

Hope this helps,
Benjamin

_______________________________________________
Lablgtk mailing list
Lablgtk@...
http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk
LightInTheBox - Buy quality products at wholesale price!