Size allocation warning message

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

Size allocation warning message

Stu Whitman
Since upgrading to GTK+ 3.22 I have been getting the message:

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

I have tried googling for a solution. I have reviewed the code. I even used GTK_DEBUG=interactive to find the referenced scrolled window, but it does not appear to be any different than the other scrolled windows in my application.

Does anyone have any hints on how to eradicate this message?

Thanks,
-Stu 

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

Re: Size allocation warning message

Rafal Luzynski
14.06.2018 20:50 Stu Whitman <[hidden email]> wrote:

>
>  Since upgrading to GTK+ 3.22 I have been getting the message:
>  
>  Gtk-WARNING **: Allocating size to GtkScrolledWindow 0x2df9240 without
> calling gtk_widget_get_preferred_width/height(). How does the code know the
> size to allocate?
>  
>  I have tried googling for a solution. I have reviewed the code. I even used
> GTK_DEBUG=interactive to find the referenced scrolled window, but it does not
> appear to be any different than the other scrolled windows in my application.
>  
>  Does anyone have any hints on how to eradicate this message?

It's difficult to help without looking at the source code.

I assume this is your application or at least an application
for which you have the source code and you are going to fix it.

My suggestion: get also the debug version of at least glib2,
also it should be helpful to get gtk3. In Fedora you can install:

    $ sudo dnf debuginfo-install glib2

or

    $ sudo dnf debuginfo-install glib2 gtk3

Then open your application in a debugger, set a breakpoint in g_log(),
and run. At least you will know where the message comes from.

As the name suggests, you should call gtk_widget_get_preferred_width/height()
before allocating (assigning) the size of the widget. Otherwise, how do
you know what is its required size? Even if you are going to allocate
a constant size you should make sure that your desired size is greater
than or equal to the required size. If the desired size is larger you
should use it instead.

Regards,

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

Re: Size allocation warning message

Stefan Salewski-2
On Mon, 2018-06-25 at 23:20 +0200, Rafal Luzynski wrote:
> I assume this is your application or at least an application
> for which you have the source code and you are going to fix it.

That are some of our applications, and at least some of ours get such
messages since at least one year, for example

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

There has been multiple complaints about that on this list, but it
seems to be not really easy to debug.
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Size allocation warning message

Timm Bäder
On 2018-06-26, Stefan Salewski wrote:

> On Mon, 2018-06-25 at 23:20 +0200, Rafal Luzynski wrote:
> > I assume this is your application or at least an application
> > for which you have the source code and you are going to fix it.
>
> That are some of our applications, and at least some of ours get such
> messages since at least one year, for example
>
> (evince:3250): Gtk-WARNING **: Allocating size to EvSidebar
> 0x55eab6d1b680 without calling gtk_widget_get_preferred_width/height().
> How does the code know the size to allocate?
>
> There has been multiple complaints about that on this list, but it
> seems to be not really easy to debug.

It is indeed not easy to debug.
The one in Evince is reported against gtk+ here:
https://gitlab.gnome.org/GNOME/gtk/issues/632 (if it's the exact same)
where I analized where it comes from.
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list