From cbd7317516eaac4a5f37c896da5ea984ec1bb77a Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Thu, 10 Apr 2014 16:09:22 +0200 Subject: CoqIDE: removing a timer may raise an exception --- ide/coq.ml | 2 +- ide/ideutils.ml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ide/coq.ml b/ide/coq.ml index 3dd2ce0065..af00cc63cd 100644 --- a/ide/coq.ml +++ b/ide/coq.ml @@ -196,7 +196,7 @@ module GlibMainLoop = struct type condition = Glib.Io.condition let add_watch ~callback chan = Glib.Io.add_watch ~cond:[`ERR; `HUP; `IN; `NVAL; `PRI] ~callback chan - let remove_watch = Glib.Io.remove + let remove_watch x = try Glib.Io.remove x with Glib.GError _ -> () let read_all = Ideutils.io_read_all let async_chan_of_file fd = Glib.Io.channel_of_descr fd let async_chan_of_socket s = !gio_channel_of_descr_socket s diff --git a/ide/ideutils.ml b/ide/ideutils.ml index 2ae46fc7e3..d8ca34f982 100644 --- a/ide/ideutils.ml +++ b/ide/ideutils.ml @@ -130,7 +130,10 @@ let mktimer () = kill = (fun () -> match !timer with | None -> () - | Some id -> GMain.Timeout.remove id; timer := None) } + | Some id -> + (try GMain.Timeout.remove id + with Glib.GError _ -> ()); + timer := None) } let last_dir = ref "" -- cgit v1.2.3