Skip to content

Cant create wigets to store it in variable #53

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

Open
Filipp-Druan opened this issue Nov 23, 2023 · 1 comment
Open

Cant create wigets to store it in variable #53

Filipp-Druan opened this issue Nov 23, 2023 · 1 comment

Comments

@Filipp-Druan
Copy link

I tried to compile this code:

(ql:quickload '(cl-gtk4))

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

(in-package gui.example)

(defvar *setting-box*
  (let ((box          (make-box :orientation +orientation-vertical+
                                :spacing 2))
        (hello-button (make-button :label "Hello!"))
        (reset-button (make-button :label "Reset")))

    (declare (ignore hello-button reset-button box))
    (print "Hello!")))

And I got this error:

Unhandled memory fault at #x0.
   [Condition of type SB-SYS:MEMORY-FAULT-ERROR]

Restarts:
 0: [ABORT] Abort compilation.
 1: [*ABORT] Return to SLY's top level.
 2: [ABORT] abort thread (#<THREAD tid=32076 "slynk-worker" RUNNING {1003D4E6A3}>)

Backtrace:
 0: (SB-SYS:MEMORY-FAULT-ERROR #<unused argument> #.(SB-SYS:INT-SAP #X00000000))
 1: ("foreign function: call_into_lisp_")
 2: ("foreign function: handle_memory_fault_emulation_trap")
 3: ("foreign function: #x555680C99CD7")
 4: ((LAMBDA (&REST GIR::ARGS-IN) :IN GIR::BUILD-FUNCTION) 1 2)
 5: ((SB-C::TOP-LEVEL-FORM (SB-IMPL::%DEFVAR #1=(QUOTE *SETTING-BOX*) (SB-C:SOURCE-LOCATION) (UNLESS (SB-INT:%BOUNDP #1#) (LET (#2=# #2# . #3=(#2#)) (DECLARE . #3#) (PRINT "Hello!")))))) [toplevel]
 6: (SB-FASL::LOAD-FASL-GROUP #S(SB-FASL::FASL-INPUT :STREAM #<SB-SYS:FD-STREAM for "file /tmp/slimeiKWK87.fasl" {1003FE78D3}> :TABLE #(63 #1="/home/iam/quicklisp/local-projects/share-files/gui.lisp" :EMA..
 7: ((LAMBDA NIL :IN SB-FASL::LOAD-AS-FASL))
 8: (SB-IMPL::CALL-WITH-LOADER-PACKAGE-NAMES #<FUNCTION (LAMBDA NIL :IN SB-FASL::LOAD-AS-FASL) {1003FF23CB}>)
 9: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /tmp/slimeiKWK87.fasl" {1003FE78D3}> NIL NIL)
10: ((LABELS SB-FASL::LOAD-STREAM-1 :IN LOAD) #<SB-SYS:FD-STREAM for "file /tmp/slimeiKWK87.fasl" {1003FE78D3}> T)
11: (SB-FASL::CALL-WITH-LOAD-BINDINGS #<FUNCTION (LABELS SB-FASL::LOAD-STREAM-1 :IN LOAD) {7FF0AD99DD6B}> #<SB-SYS:FD-STREAM for "file /tmp/slimeiKWK87.fasl" {1003FE78D3}> T #<SB-SYS:FD-STREAM for "file /..
12: (LOAD #P"/tmp/slimeiKWK87.fasl" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST :ERROR :EXTERNAL-FORMAT :DEFAULT)
13: ((FLET SLYNK-BACKEND:CALL-WITH-COMPILATION-HOOKS :IN "/home/iam/.emacs.d/elpa/sly-20230924.811/slynk/backend/sbcl.lisp") #<FUNCTION (LAMBDA NIL :IN SLYNK-BACKEND:SLYNK-COMPILE-STRING) {1003FE77BB}>)
14: ((FLET SLYNK-BACKEND:SLYNK-COMPILE-STRING :IN "/home/iam/.emacs.d/elpa/sly-20230924.811/slynk/backend/sbcl.lisp") "(defvar *setting-box* ..)
15: ((LAMBDA NIL :IN SLYNK:COMPILE-STRING-FOR-EMACS))
16: ((LAMBDA NIL :IN SLYNK::COLLECT-NOTES))
 --more--
@bohonghuang
Copy link
Owner

You must create the widget within the GTK event loop and assign it to this global variable, as most of GTK's functionality relies on the application context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants