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

Not working, finished with non-zero exit value 139 #22

Open
MarkusTieger opened this issue May 20, 2023 · 8 comments
Open

Not working, finished with non-zero exit value 139 #22

MarkusTieger opened this issue May 20, 2023 · 8 comments

Comments

@MarkusTieger
Copy link

MarkusTieger commented May 20, 2023

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.

image

(Running on Garuda Linux, gtk 4 is installed and other gtk 4 application does work)

@MarkusTieger
Copy link
Author

I would also mention that i disabled the tests in the gradle file, because the testBytes() test failed.

@bailuk
Copy link
Owner

bailuk commented May 23, 2023

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.

@MarkusTieger
Copy link
Author

MarkusTieger commented Jun 22, 2023

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)

@bailuk
Copy link
Owner

bailuk commented Jul 3, 2023

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.

@MarkusTieger
Copy link
Author

MarkusTieger commented Jul 7, 2023

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)

@bailuk
Copy link
Owner

bailuk commented Aug 7, 2023

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...

@MarkusTieger
Copy link
Author

weird.

But can confirm, works after running "export GTK_THEME=Adwaita-dark"

@bailuk
Copy link
Owner

bailuk commented Jan 23, 2024

It looks like java-gtk apps generally crash when using themes. Can someone confirm this? Any Ideas how can be debugged and traced?

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