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

Cannot load GTK 4 (3.96.0) #226

Closed
valpackett opened this issue Jul 4, 2019 · 7 comments · Fixed by #273
Closed

Cannot load GTK 4 (3.96.0) #226

valpackett opened this issue Jul 4, 2019 · 7 comments · Fixed by #273

Comments

@valpackett
Copy link

lua53: ./lgi/override/Gdk.lua:23: bad argument #1 to 'registerlock' (userdata expected, got nil)
stack traceback:
        [C]: in function 'lgi.core.registerlock'
        ./lgi/override/Gdk.lua:23: in main chunk
        [C]: in function 'require'
        ./lgi/namespace.lua:183: in function 'lgi.namespace.require'
        ./lgi/namespace.lua:170: in function 'lgi.namespace.require'
        samples/console.lua:7: in main chunk
        [C]: in ?
@psychon
Copy link
Collaborator

psychon commented Jul 4, 2019

Line 23 is:

core.registerlock(core.gi.Gdk.resolve.gdk_threads_set_lock_functions)

According to https://developer.gnome.org/gdk3/stable/gdk3-Threads.html#gdk-threads-set-lock-functions, gdk_threads_set_lock_functions was deprecated in Gdk 3.6. I guess that means it was removed in Gdk / Gtk 4. According to https://developer.gnome.org/gdk4/stable/, the whole threads API was removed (???).

The only way forward that I see is to just drop this lock-related code (just remove line 23 of said file) and update the documentation to point out explicitly that in GTK 4, we do not provide thread-safety, because GTK 4 provides All GDK and GTK+ calls should be made from the main thread as the replacements for the dropped APIs.

(Note that removing line 23 will likely just uncover more problems. Line 24 tries to call gdk_threads_init(), which was also deprecated and I bet dropped in Gtk 4.)

@naipotato
Copy link

Another thing to point out here, GtkContainer no longer exists, so overrides for it will no longer work

https://developer.gnome.org/gtk4/stable/ch41s02.html#id-1.7.4.4.29

The idea with this change was to simplify the creation of custom widgets, in addition to encouraging the concept of "composition over inheritance" and "everything is a widget"

@TingPing
Copy link
Contributor

TingPing commented Dec 24, 2020

This is an old comment but I just wanted to add:

The only way forward that I see is to just drop this lock-related code (just remove line 23 of said file) and update the documentation to point out explicitly that in GTK 4, we do not provide thread-safety, because GTK 4 provides All GDK and GTK+ calls should be made from the main thread as the replacements for the dropped APIs.

GTK has never been thread safe and the locks were never enough to be thread safe.

@1ctinus
Copy link

1ctinus commented Mar 24, 2021

any updates on this?

sodomon2 added a commit to sodomon2/SODPlayer that referenced this issue Apr 4, 2021
@llothar
Copy link

llothar commented Jun 4, 2021

any updates on this?

Yes please. I'm considering using Gtk4 for a new project but i need to have Lua scripting.

@TingPing
Copy link
Contributor

TingPing commented Jun 6, 2021

I fiddled with this but it requires a decent amount more work I believe: TingPing@eeafbb5

@darltrash
Copy link

is LGI ever going to support GTK4 at all?

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

Successfully merging a pull request may close this issue.

7 participants