Delivered-To: lablgtk at yquem.inria.fr To: lablgtk at yquem.inria.fr References: <87mypo509s.fsf at wanadoo.fr> From: Yoann Padioleau Date: Mon, 25 Feb 2008 13:11:38 -0600 In-Reply-To: <87mypo509s.fsf at wanadoo.fr> (Yoann Padioleau's message of "Mon, 25 Feb 2008 13:00:47 -0600") Message-ID: <87ir0c4zrp.fsf at wanadoo.fr> MIME-Version: 1.0 Subject: [Lablgtk] Re: uncaught exception in callback Content-Type: text/plain; charset=us-ascii Content-Length: 1901 Yoann Padioleau writes: > Hi, > > Is it possible to desactivate the capture of exceptions in > lablgtk code ? I want to debug my code and see where one > my exception is launched but I can not get the backtrace > because of lablgtk which does not let the exception > unwind to the top. I saw this in gtkSignal.ml let user_handler = ref raise ... let connect ~(sgn : ('a, _) t) ~callback ?(after=false) (obj : 'a obj) = let callback argv = let old = push_callback () in begin try sgn.marshaller callback argv with exn -> try !user_handler exn with exn -> Printf.eprintf "In callback for signal %s, uncaught exception: %s\n" sgn.name (Printexc.to_string exn); flush stderr end; if pop_callback old then emit_stop_by_name obj ~name:sgn.name in connect_by_name obj ~name:sgn.name ~callback:(Closure.create callback) ~after Would it be possible to have instead a global flag that the user/programmer can set to control this behaviour ? Or maybe just change a little the code to something like this instead: let user_handler = ref (fun exn -> Printf.eprintf "In callback for signal %s, uncaught exception: %s\n" sgn.name (Printexc.to_string exn); flush stderr; raise exn ) let connect ~(sgn : ('a, _) t) ~callback ?(after=false) (obj : 'a obj) = let callback argv = let old = push_callback () in begin try sgn.marshaller callback argv with exn -> !user_handler exn end; if pop_callback old then emit_stop_by_name obj ~name:sgn.name in connect_by_name obj ~name:sgn.name ~callback:(Closure.create callback) ~after _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk