From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 82BD5BB84 for ; Mon, 8 May 2006 20:26:00 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k48IPxbB026867 for ; Mon, 8 May 2006 20:25:59 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA16005 for ; Mon, 8 May 2006 20:25:58 +0200 (MET DST) Received: from mallaury.nerim.net (smtp-101-monday.noc.nerim.net [62.4.17.101]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k48IPwBr026864 for ; Mon, 8 May 2006 20:25:58 +0200 Received: from webmail.nerim.net (archimonde.nerim.net [62.4.16.97]) by mallaury.nerim.net (Postfix) with ESMTP id 6D6654F3B0; Mon, 8 May 2006 20:25:46 +0200 (CEST) Received: from 213.41.240.180 (SquirrelMail authenticated user oandrieu) by webmail.nerim.net with HTTP; Mon, 8 May 2006 20:25:51 +0200 (CEST) Message-ID: <59824.213.41.240.180.1147112751.squirrel@webmail.nerim.net> In-Reply-To: <445E4697.3010109@gushee.net> References: <445E4697.3010109@gushee.net> Date: Mon, 8 May 2006 20:25:51 +0200 (CEST) Subject: Re: [Caml-list] LablGTK2: problem w/ GMain.Io From: "Olivier Andrieu" To: "Matt Gushee" Cc: caml-list@inria.fr User-Agent: SquirrelMail/1.4.5 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Miltered: at nez-perce with ID 445F8D37.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 445F8D36.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lablgtk:01 gmain:01 andrieu:01 oandrieu:01 nerim:01 labltk:01 lablgtk:01 ocaml:01 3.08.4:01 gtk:01 gtk:01 ocaml-:01 initialized:01 giochannel:01 uncaught:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hi, > I have a GUI application (the Bantam file manager) that I originally > wrote in LablTk, and have just ported to LablGTK2. I wrote most of the > code on a Slackware 10.1 box using GODI with OCaml 3.08.4 and LablGTK2 > 20040716. The GTK2 version is 2.6.1. After implementing all current > features in GTK and eliminating most of the known serious bugs, I built > and installed the package on my other Linux box, which runs Arch Linux > 0.7.1, with Ocaml-3.09.2, GTK2-2.8.17, and LablGTK2-2.6.0. > > Since I found startup to be a bit slow with GTK, I implemented a 'daemon > mode' for the application. When you start it in daemon mode, the GUI is > initialized, but remains hidden until it receives a '%show' command via > a named pipe. Also, when you 'quit' the application via a keystroke > command or the window manager, it actually only hides the main window. > To actually quit the application in daemon mode, you send a '%quit' > command via the above-mentioned pipe. > > Here's the problem: on the development (Slackware) box, I had the app > running in both normal (GUI shows on startup & is destroyed by quitting) > and daemon modes with no apparent problems. On the second box, normal > mode works fine; the app will also run in daemon mode. But when I > attempt to send a command to the app in daemon mode, I get the following > error message: > > ** (bantam.bin:13244): CRITICAL **: GIOChannel watch: callback raised \ > an exception That's because your callback raised an exception (!). LablGTK traps uncaught exceptions from callbacks instead of re-raising them and exiting the main loop. For signals, there is a user-overridable handler that simply prints the exception name to stderr ; for other types of callbacks (IO watches, timeouts, etc.) you simply get this error message. In your code you should wrap your "watcher" function in a try...with block and print the exception using Printexc.to_string to see what's going wrong. -- Olivier