Comments (10)
I have commented out object unref and the code seems to work.
I did not know about not having to copy everything from C code and use g_object_unref. Thank you very much for your help. The code now works, and after your library changes, it needed only small modifications. You may close the issue.
from cl-gtk4.
The first error. Other errors are similar.
; caught ERROR:
; READ error during COMPILE-FILE:
;
; Symbol "GLIST-LIST" not found in the GLIB package.
;
; Line: 51, Column: 26, File-Position: 2043
;
; Stream: #<SB-INT:FORM-TRACKING-STREAM for "file /home/jacek/quicklisp/local-projects/cl-gtk4/gtk4.lisp" {10028AE9E3}>
from cl-gtk4.
The first error. Other errors are similar.
; caught ERROR:
; READ error during COMPILE-FILE:
;
; Symbol "GLIST-LIST" not found in the GLIB package.
;
; Line: 51, Column: 26, File-Position: 2043
;
; Stream: #<SB-INT:FORM-TRACKING-STREAM for "file /home/jacek/quicklisp/local-projects/cl-gtk4/gtk4.lisp" {10028AE9E3}>
Have you updated cl-glib and cl-gobject-introspection-wrapper?
from cl-gtk4.
How do I do it? Looking at the quicklisp folder, I do not see them. Also, it is getting late here; I will respond tomorrow.
/home/jacek/quicklisp/dists/ultralisp/software
from cl-gtk4.
How do I do it? Looking at the quicklisp folder, I do not see them. Also, it is getting late here; I will respond tomorrow. /home/jacek/quicklisp/dists/ultralisp/software
Just clone these 2 repositories into quicklisp/local-projects
, so that Quicklisp will give priority to loading them.
from cl-gtk4.
How do I do g_object_unref after the change?
from cl-gtk4.
How do I do g_object_unref after the change?
(ql:quickload :glib.gobject)
and use gobj:object-unref
, while it's unnecessary and even unsafe to do this manually in most cases:
(loop :repeat 100000
:do (mapcar (alexandria:rcurry #'gobj:pointer-object 'window) ; This never leaks memory
(glib:glist-list (application-windows app))))
from cl-gtk4.
I mean places like:
https://github.com/bigos/Pyrulis/blob/8bb8c87cfebc8034824a9bc22200f567d7ad213d/Lisp/cl-gtk4-tictactoe.lisp#L741
https://github.com/bigos/Pyrulis/blob/8bb8c87cfebc8034824a9bc22200f567d7ad213d/Lisp/cl-gtk4-tictactoe.lisp#L668
Some Gtk4 examples require to unref objects.
This is taken from the branch that had to be modified to compile with the new version of cl-gtk4. The old master branch works with older version of cl-gtk4 with my modifications.
It appears the Gtk4 needs it in certain places
https://docs.gtk.org/gobject/method.Object.unref.html
https://stackoverflow.com/questions/69135934/creating-a-simple-menubar-menu-and-menu-item-in-c-using-gtk4
and I do not know how to write working code without calling unref. Do you have any suggestions?
from cl-gtk4.
Does the code work without gobj:object-unref
? Some C examples of GTK involve it, because C doesn't manage the memory automatically, forcing the programmer to unref a object when it is no longer needed. But Lisp has GC and can unref the unreachable objects at its own, so there is no point invoking gobj:object-unref
unless you are interacting with GTK through CFFI.
from cl-gtk4.
Good question! The memory management questions: https://docs.gtk.org/gtk4/question_index.html , have interesting comments on the subject. Perhaps the following quote will provide further answers for me. I am new to Gtk4, so some of my questions may be a bit wrong.
The transfer annotations for gobject-introspection that are part of the documentation can provide useful hints for memory handling semantics as well.
from cl-gtk4.
Related Issues (20)
- Typelib file for namespace 'Gtk', version '4.0' not found HOT 4
- How to make a GListStore of fixnums / How to subclass GObject HOT 2
- Library needs more documentation HOT 1
- Can't create simple application. HOT 4
- FLOATING-POINT-INVALID-OPERATION HOT 5
- arithmetic error DIVISION-BY-ZERO signalled HOT 2
- Cant create wigets to store it in variable HOT 1
- When vertically scaling the window, there is an artifact with the buttons. HOT 1
- No symbol named "POINTER-OBJECT" HOT 2
- Error g_error_free on Windows 11 HOT 6
- Can't properly pass "user_data" to callback for open file dialog HOT 2
- Support for Subclassing? HOT 1
- Radio buttons HOT 1
- Connect widget to key-pressed event HOT 3
- Can I create my own widgets? HOT 2
- (ql:quickload :cl-gtk4) fails, many issues: HOT 3
- Hoping for examples or documents about dialogs HOT 2
- Making executable HOT 2
- cl-gtk4 not working under SBCL v2.4.5 HOT 2
- Compilation error when expanding RUN-IN-MAIN-EVENT-LOOP macro HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cl-gtk4.