Closed lucaguada closed 1 year ago
I suspect the segfault happens because you didn't call gtk_application_window_new
from inside the activate
callback of the GtkApplication. If you look at the "hello world" example on the Gtk website, you will see that it first connects the "activate" signal to the static void activate()
function.
You can do the same in Java with Panama, but it requires some work. First you add a Java method static void activate(MemorySegment app, MemorySegment userData)
, and then create an upcall stub as described here, and then invoke g_signal_connect_data
to connect the "activate" signal to the upcall stub. From inside the callback method, you can then create the application window.
thank you so much for the help! I will try your solution!
Sorry for contacting you in this way, but I wasn't able to find any email or Twitter account of yours :-(
I was trying to have some fun with Panama and GTK, with no results, however, by finding your repo I wondered if you could give some advice for resolving my issue. Here I have my repo, I was able to generate the necessary binding code between Panama and GTK by using
jextract
, but then when I tried to follow the Hello World example, on gtk-window creation everything fails (there's a better readme in the repo).Did I miss something? Or my approach is too trivial and skipped some necessary steps?
I'm working on PopOS Linux (Ubuntu variant) with GTK4. Thanks in advance!