bohonghuang / cl-gtk4

GTK4/Libadwaita/WebKit2 bindings for Common Lisp.
GNU Lesser General Public License v3.0
216 stars 9 forks source link

arithmetic error DIVISION-BY-ZERO signalled #52

Open Filipp-Druan opened 1 year ago

Filipp-Druan commented 1 year ago

I set out to catch the errors, to understand when they occur. I restarted REPL, compiled this code:

(ql:quickload '(cl-gtk4))

(defpackage gui.example
  (:use :cl :gtk4))

(in-package gui.example)

(define-application (:name main
                     :id   "org.filipp.main")
  (define-main-window (main-window (make-application-window :application
                                                            *application*))
    (setf (window-title main-window)
          "Share-files")

    (unless (widget-visible-p main-window)
      (window-present main-window))))

And I got this:

arithmetic error DIVISION-BY-ZERO signalled
   [Condition of type DIVISION-BY-ZERO]

Restarts:
 0: [RETRY] Retry SLY mREPL evaluation request.
 1: [*ABORT] Return to SLY's top level.
 2: [ABORT] abort thread (#<THREAD tid=32195 "sly-channel-1-mrepl-remote-1" RUNNING {10013E00A3}>)

Backtrace:
 0: ((FLET SB-UNIX::RUN-HANDLER :IN SB-UNIX::%INSTALL-HANDLER) 8 #.(SB-SYS:INT-SAP #X7F470A8DC870) #.(SB-SYS:INT-SAP #X7F470A8DC740))
      Locals:
        SB-UNIX::CONTEXT-SAP = #.(SB-SYS:INT-SAP #X7F470A8DC740)
        SB-UNIX::INFO-SAP = #.(SB-SYS:INT-SAP #X7F470A8DC870)
        SB-UNIX::SIGNO = 8
 1: ("foreign function: call_into_lisp_")
      [No Locals]
 2: ("foreign function: interrupt_handle_now_handler")
      [No Locals]
 3: ((LAMBDA (&REST GIR::ARGS-IN) :IN GIR::BUILD-FUNCTION) #.(SB-SYS:INT-SAP #X7F46FC062600) NIL)
      Locals:
        GIR::ARGS-IN = (#.(SB-SYS:INT-SAP #X7F46FC062600) NIL)
        GIR::GIARGS-IN = #.(SB-SYS:INT-SAP #X7F46FC00BAE0)
        GIR::GIARGS-OUT = #.(SB-SYS:INT-SAP #X7F46FC010A10)
        GIR::OUT-ARGS = NIL
        GIR::RET-VAL = #<GIR::RETURN-VALUE {1004BC10E3}>
 4: (GIO:APPLICATION-RUN #<GIR::OBJECT-INSTANCE {1004A599E3}> NIL)
      Locals:
        APPLICATION = #<GIR::OBJECT-INSTANCE {1004A599E3}>
        ARGV = NIL
 5: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MAIN) #<NULL-LEXENV>)
      Locals:
        SB-KERNEL:LEXENV = #<NULL-LEXENV>
        SB-IMPL::ORIGINAL-EXP = (MAIN)
 6: (EVAL (MAIN))
      Locals:
        SB-IMPL::ORIGINAL-EXP = (MAIN)

I restarted everything again, but didn't put the cursor on the window. Everything was fine. But as soon as I put the cursor on the window, I got this error!

After the error appears, you can't do anything with the window and have to kill the SBCL process. I am using SBCL 2.3.8 on Manjaro Linux.

bohonghuang commented 1 year ago

Did you try (sb-int:set-floating-point-modes :traps nil)? This doesn't seem like an error thrown by Lisp itself. If you try it, dividing by 0 will not be an error, but it will result in infinity.

Filipp-Druan commented 1 year ago

(sb-int:set-floating-point-modes :traps nil)

It's working! Everything's back to normal!