Re: Size allocation warning message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



14.06.2018 20:50 Stu Whitman <swhitman@xxxxxxxxxx> 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
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux