g_log_set_fatal_mask() not working for me.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

g_log_set_fatal_mask() not working for me.

Richard Shann
I am getting a warning message:

 Gtk-WARNING **: Allocating size to GtkScrollbar 0x55555647efd0 without
calling gtk_widget_get_preferred_width/height(). How does the code know
the size to allocate?

however when I call

call g_log_set_fatal_mask ("Gtk", 1<<4)

at the start of main the warning is not converted into a fatal error.
I've tried

call g_log_set_fatal_mask ("Gtk", 0xFFFF)

as well, to no avail.

This is with Gtk version runtime: 3.22.11, compiled against: 3.22.11

Any suggestions to track down the source of the trouble gratefully
received...

Richard Shann
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: g_log_set_fatal_mask() not working for me.

Gtk+ - Apps Dev mailing list

 
Hi Richard,

This sounds similar to the problem Dino Aljević had in "Scrolled TreeView and size allocation warnings" in this list in September?

I can get the warning

"(treeview4:3830): Gtk-WARNING **: Allocating size to GtkWindow 0x843e188 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?"

with the following code with GTK3.22.26 but I don't see the warning in GTK3.18.9. To get the warning expand the treeview until the list extends past the window boundry. I looked on Bugzilla but I didn't see it listed there. I am not great at finding things on Bugzilla so that doesn't mean it isn't there.

Do you have some test code to produce the GtkScrollbar warning you are seeing?

For the g_log_set_fatal_mask() and a runtime stop, try starting your code with

G_DEBUG=fatal-warnings

It is a warning though. Something needs to be fixed but your program should run fine.

Eric



/*
    gcc -Wall treeview4.c -o treeview4 `pkg-config --cflags --libs gtk+-3.0`
    Tested on Ubuntu16.04 with GTK3.18.9 and GTK3.22.26

    run with

    G_DEBUG=fatal-warnings GTK_THEME=Adwaita:dark ./treeview4

    this theme doesn't produce any css warnings with GTK3.22.26.

*/
#include<gtk/gtk.h>

static GtkTreeStore* get_tree_store();

int main(int argc, char *argv[])
  {
    gtk_init(&argc, &argv);

    g_print("%i.%i.%i\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);

    g_log_set_fatal_mask("Gtk", G_LOG_LEVEL_WARNING);

    GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "Tree View");
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
    g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

    GtkTreeStore *store=get_tree_store();

    GtkWidget *tree=gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
    gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tree), TRUE);
    g_object_unref(G_OBJECT(store));

    GtkCellRenderer *renderer1=gtk_cell_renderer_text_new();
    g_object_set(renderer1, "editable", TRUE, NULL);
   
    GtkTreeViewColumn *column1 = gtk_tree_view_column_new_with_attributes("Shape Coordinates", renderer1, "text", 0, NULL);
    gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column1);

    GtkWidget *scroll=gtk_scrolled_window_new(NULL, NULL);
    gtk_container_set_border_width(GTK_CONTAINER(scroll), 5);
    gtk_widget_set_vexpand(scroll, TRUE);
    gtk_widget_set_hexpand(scroll, TRUE);
    gtk_container_add(GTK_CONTAINER(scroll), tree);  
   
    GtkWidget *grid=gtk_grid_new();
    gtk_container_set_border_width(GTK_CONTAINER(grid), 20);
    gtk_grid_attach(GTK_GRID(grid), scroll, 0, 0, 1, 1);
    gtk_container_add(GTK_CONTAINER(window), grid);
   
    gtk_widget_show_all(window);
    gtk_main();
    return 0;  
  }
static GtkTreeStore* get_tree_store()
  {
    gint i=0;
    gint j=0;
    GtkTreeStore *store=gtk_tree_store_new(1, G_TYPE_STRING);
       
    GtkTreeIter iter1;
    GtkTreeIter iter2;
    gtk_tree_store_append(store, &iter1, NULL);
    for(i=0;i<3;i++)
      {
        gchar *string1=g_strdup_printf("S%i", i);
        gtk_tree_store_set(store, &iter1, 0, string1, -1);
        g_free(string1);
        for(j=0;j<5;j++)
          {
            gtk_tree_store_append(store, &iter2, &iter1);  
            gchar *string2=g_strdup_printf("C%i", j);
            gtk_tree_store_set(store, &iter2, 0, string2, -1);
            g_free(string2);
          }
        gtk_tree_store_append(store, &iter1, NULL);
      }
 
    return store;
  }

 


_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: g_log_set_fatal_mask() not working for me.

Richard Shann
On Sun, 2017-12-17 at 17:54 -0500, [hidden email] wrote:

>
> Hi Richard,
>
> This sounds similar to the problem Dino Aljević had in "Scrolled
> TreeView and size allocation warnings" in this list in September?
>
> I can get the warning
>
> "(treeview4:3830): Gtk-WARNING **: Allocating size to GtkWindow
> 0x843e188 without calling gtk_widget_get_preferred_width/height().
> How does the code know the size to allocate?"
>
> with the following code with GTK3.22.26 but I don't see the warning
> in GTK3.18.9. To get the warning expand the treeview until the list
> extends past the window boundry. I looked on Bugzilla but I didn't
> see it listed there. I am not great at finding things on Bugzilla so
> that doesn't mean it isn't there.
>
> Do you have some test code to produce the GtkScrollbar warning you
> are seeing?

No, indeed, the warnings are appearing during the start up of a very
large program and I'm trying to locate the part of the program they are
coming from ...

>
> For the g_log_set_fatal_mask() and a runtime
> stop, try starting your code with 
>
> G_DEBUG=fatal-warnings
>
That's good to know, but it is rather a blunt instrument, calling
g_log_set_fatal_mask() from the debugger normally lets you pin down
particular warnings. Bizarrely, at present gdb has suddenly got amnesia
and declares
(gdb) call g_log_set_fatal_mask ("Gtk", 0xFFFF)
No symbol "g_log_set_fatal_mask" in current context.
Where previously it was returning the previous mask as it should.

> It is a warning though. Something needs to be fixed but your program
> should run fine.

Yes, it doesn't seem to cause a problem, but there is worse to come - I
have had a couple of crashes coming from Gtk since upgrading to Debian
Stable (hence Gtk 3.22) and I can get this:

Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0'
failed in GtkScrollbar

during a gtk_widget_show_all () of a widget that has previously been
working. At least I know where this one is happening...

Thanks for you helpful reply,

Richard
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: g_log_set_fatal_mask() not working for me.

Gtk+ - Apps Dev mailing list

 
I found this bug for the scrollbar warning.

https://bugzilla.gnome.org/show_bug.cgi?id=769566

I don't know about the critical warning that you have or have a solution figured out. I am not much help there.

Eric


_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list