Not working, finished with non-zero exit value 139
The example or anything coded with this library isn't working. I tested it with self compiling and with the jitpack version. Both not working. the example with "make run" does also not work.
(Running on Garuda Linux, gtk 4 is installed and other gtk 4 application does work)
I would also mention that i disabled the tests in the gradle file, because the testBytes() test failed.
Does this fail with current main or tag v0.4.0? (After clean and rebuild)
If so, can you provide more information about your environment: Hardware platform, OS, Distribution.
Also it would be interesting to see where testBytes() fails. A test report gets generated in java-gtk/build/reports/tests/test/index.html.
I am currently using "Arch Linux" (Garuda) with the Linux Kernel "xanmod-linux-bin-x64v3". It doesn't work on the "main" branch. Java: Temurin 17 The report file: https://gist.github.com/MarkusTieger/24e28129a77a9847241be9b299114f1c (uploaded as gist)
(still not fixed, sorry for taking so long to answer)
Tested with Garuda Linux GNOME: Everything works with both Default Kernel and jdk16-graalvm, as well as xanamod kernel and java-17-temurin. So the Problem must be something else.
Can you retry building and running from freshly cloned repository and provide classes/ch.bailu.gtk.TestGBytes.html so I can see where the test fails.
I am also using cinnamon, that could also be the reason, but other GTK Applications work there. For example i had no problems with the not updated library "java-gnome", which is still on gtk3.
The classes/ch.bailu.gtk.TestGBytes.html file: https://github.com/MarkusTieger/java-gtk-with-files/blob/stage/java-gtk/build/reports/tests/test/classes/ch.bailu.gtk.TestGBytes.html
(i created a public repository: https://github.com/MarkusTieger/java-gtk-with-files, where i removed the gitignore and commited the state after the gradlew build failed, in the case you also need some other files from there)
Finally I was able to reproduce this crashes.
The failed test and (example) application crash are not related. The failed test issue is now fixed.
The application crash (when running ./gradlew run or when running HelloWorld.java from within VisualCode) is somehow related to the default theme of Garuda Cinnamon. The theme is called Sweet-Dark and is stored in /usr/share/themes/Sweet-Dark/gtk-4.0.
When switching to the Adwaita theme everything works.
The crash happens when calling app.run(...).
This c application works with all themes:
// compile: gcc $( pkg-config --cflags gtk4 ) -o hello hello.c $( pkg-config --libs gtk4 )
#include <gtk/gtk.h>
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *window;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
gtk_widget_show (window);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
while this equivalent Java application works not with the default theme:
package examples;
import ch.bailu.gtk.gio.ApplicationFlags;
import ch.bailu.gtk.gtk.Application;
import ch.bailu.gtk.gtk.ApplicationWindow;
import ch.bailu.gtk.type.Str;
import ch.bailu.gtk.type.Strs;
public class HelloWorld {
public static void main(String[] args) {
var app = new Application(new Str("org.gtk.example"),
ApplicationFlags.DEFAULT_FLAGS);
app.onActivate(() -> {
// Create a new window
var window = new ApplicationWindow(app);
window.setTitle("Window");
window.setDefaultSize(200, 200);
window.show();
});
// Start application main loop
var result = app.run(0, new Strs(args));
app.unref();
// Terminate with exit code
System.exit(result);
}
}
Now someone needs to figure out why...
weird.
But can confirm, works after running "export GTK_THEME=Adwaita-dark"
It looks like java-gtk apps generally crash when using themes. Can someone confirm this? Any Ideas how can be debugged and traced?