vinceliuice / Matcha-gtk-theme

Matcha is a flat Design theme for GTK 3, GTK 2 and Gnome-Shell
https://www.pling.com/p/1187179/
GNU General Public License v3.0
742 stars 67 forks source link

CRITICAL messages on GTK4 when closing a dialog #189

Closed alex-tee closed 2 years ago

alex-tee commented 2 years ago

I get the following messages every time I attempt to close a dialog with GTK 4.4.0 or GTK 4.5.0:

(hello-world-gtk:89955): Gsk-CRITICAL **: 22:04:18.222: gsk_radial_gradient_node_new: assertion 'color_stops[i].offset >= color_stops[i - 1].offset' failed
(hello-world-gtk:89955): Gsk-CRITICAL **: 22:04:18.222: gsk_render_node_ref: assertion 'GSK_IS_RENDER_NODE (node)' failed
(hello-world-gtk:89955): Gsk-CRITICAL **: 22:04:18.222: gsk_render_node_unref: assertion 'GSK_IS_RENDER_NODE (node)' failed

Steps to reproduce

  1. Use any matcha theme
  2. Click the button in the example below
  3. Click "Close" in the dialog
#include <gtk/gtk.h>

static GtkWidget * menubutton;
static GMenu * menu = NULL;

static void
print_hello_and_set_menubutton_model (GtkWidget *widget,
             gpointer   data)
{
  GtkWindow * window = GTK_WINDOW (data);
  g_print ("Hello World\n");

  GtkWidget * dialog =
    gtk_message_dialog_new (
      GTK_WINDOW (data), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
      GTK_BUTTONS_CLOSE, "%s", "test");
  gtk_window_set_title (GTK_WINDOW (dialog), "my dialog");
  gtk_window_set_icon_name (GTK_WINDOW (dialog), "edit-copy");
  gtk_window_set_transient_for (GTK_WINDOW (dialog), window);
  gtk_widget_show (GTK_WIDGET (dialog));

  g_signal_connect (dialog, "response",
                  G_CALLBACK (gtk_window_destroy),
                  NULL);
}

static void
activate (GtkApplication *app,
          gpointer        user_data)
{
  GtkWidget *window;
  GtkWidget *button;

  window = gtk_application_window_new (app);
  gtk_window_set_title (GTK_WINDOW (window), "Window");
  gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);

  button = gtk_button_new_with_label ("Hello World");
  g_signal_connect (button, "clicked", G_CALLBACK (print_hello_and_set_menubutton_model), window);
  gtk_window_set_child (GTK_WINDOW (window), button);

  gtk_window_present (GTK_WINDOW (window));
}

int
main (int    argc,
      char **argv)
{
  GtkApplication *app;
  int status;

  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
  status = g_application_run (G_APPLICATION (app), argc, argv);
  g_object_unref (app);

  return status;
}

compile with:

gcc -o hello-world-gtk main3.c `pkg-config --cflags --libs gtk4`

Note: I also reported this to GTK because it could be a GTK issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/4424

alex-tee commented 2 years ago

fixed upstream