Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

labltk exception #8046

Closed
vicuna opened this issue Mar 7, 2003 · 4 comments
Closed

labltk exception #8046

vicuna opened this issue Mar 7, 2003 · 4 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 7, 2003

Original bug ID: 1575
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Kun Gao
Version: 3.06
OS: Linux
Submission from: adsl-66-127-57-108.dsl.snfc21.pacbell.net (66.127.57.108)

Labltk does not propogate exceptions. Any exceptions raised inside of Tk code
does not get propogated outside of Tk...

For example:

let top = openTk ()
...
...
raise Some_exception;
...
...
Printexc.print mainLoop();

The exception will not be caught by the last line...

@vicuna
Copy link
Author

vicuna commented Mar 7, 2003

Comment author: administrator

Hi,
Here is the code I used, the exception never gets out of
mainLoop. I am not sure if this is the correct behavior? Or should the
exception be caught?


open Tk;;
let top = openTk() in
let b = Button.create top ~text:"raise!"
~command: (fun _ -> closeTk(); raise Exit )
in
pack [b];
try mainLoop()
with e -> Printf.printf "caught something"


Kun

-----Original Message-----
From: Jun P. FURUSE [mailto:Jun.Furuse@inria.fr]
Sent: Friday, March 07, 2003 3:08
To: kgao@uclink.berkeley.edu
Cc: caml@pauillac.inria.fr; caml-bugs@pauillac.inria.fr
Subject: Re: labltk exception (#8046)

Hello,

Labltk does not propogate exceptions. Any exceptions raised inside of
Tk code
does not get propogated outside of Tk...

For example:

let top = openTk ()
...
...
raise Some_exception;
...
...
Printexc.print mainLoop();

The exception will not be caught by the last line...

What does "Tk code" mean? Code invoked by tk events?
If it is, exceptions will be caught correctly.
(Otherwise, this is a bug.)
Try the following:


open Tk;;
let top = openTk ();;
let b = Button.create top ~text: "raise!" ~command: (fun _ -> raise
Exit);;
pack [b];;
let _ = Printexc.print mainLoop ();;

What the last line catches only the exceptions raised inside the
callbacks.
Even if Tk related, the other exceptions are never caught:


open Tk;;
let top = openTk ();;
pack [top];; (* illegal packing which raises an exception *)
let _ = Printexc.print mainLoop ();;

--
Jun

@vicuna
Copy link
Author

vicuna commented Mar 7, 2003

Comment author: administrator

Hello,

Labltk does not propogate exceptions. Any exceptions raised inside of Tk code
does not get propogated outside of Tk...

For example:

let top = openTk ()
...
...
raise Some_exception;
...
...
Printexc.print mainLoop();

The exception will not be caught by the last line...

What does "Tk code" mean? Code invoked by tk events?
If it is, exceptions will be caught correctly.
(Otherwise, this is a bug.)
Try the following:


open Tk;;
let top = openTk ();;
let b = Button.create top ~text: "raise!" ~command: (fun _ -> raise Exit);;
pack [b];;
let _ = Printexc.print mainLoop ();;

What the last line catches only the exceptions raised inside the callbacks.
Even if Tk related, the other exceptions are never caught:


open Tk;;
let top = openTk ();;
pack [top];; (* illegal packing which raises an exception *)
let _ = Printexc.print mainLoop ();;

--
Jun

@vicuna
Copy link
Author

vicuna commented Mar 7, 2003

Comment author: administrator

Hi,
Here is the code I used, the exception never gets out of
mainLoop. I am not sure if this is the correct behavior? Or should the
exception be caught?

Oops. My last mail was not correct. I am sorry.

I verified the labltk source carefully, and found that
labltk catches all the exceptions raised in the callbacks and
prints out "Uncaught exception: blahblah" on the screen.
(otherlibs/labltk/support/protocol.ml, around line 180)

I cannot immediately say this behaviour is "correct" or not,
but I think usually it is a good idea to handle exceptions from
a callback inside itself.

--
Jun

@vicuna
Copy link
Author

vicuna commented Mar 10, 2003

Comment author: administrator

Current Labltk implementation doesn't propagate exceptions out of callbacks.
This looks like a reasonable thing to do for the time being.

@vicuna vicuna closed this as completed Mar 10, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant