"Can't update stage views actor XXXXXXXXX is on because it needs an allocation" message

Hi all:

I developed an extension and it works fine, but every time I fill an element, I receive these messages:

Can't update stage views actor overviewGroup is on because it needs an allocation.
Can't update stage views actor overview is on because it needs an allocation.
Can't update stage views actor Gjs_ui_overviewControls_ControlsManager is on because it needs an allocation.
Can't update stage views actor overview-group is on because it needs an allocation.
Can't update stage views actor viewSelector is on because it needs an allocation.
Can't update stage views actor StBin is on because it needs an allocation.
Can't update stage views actor StBin is on because it needs an allocation.
Can't update stage views actor StScrollView is on because it needs an allocation.
Can't update stage views actor StBoxLayout is on because it needs an allocation.
[..]

And more. There is one message for each element that I create. All of them are StBoxLayout, StBin or StScrollView, so I presume that they already have an allocator. I read all the documentation in Clutter and St, but haven’t found a clue about why I receive these messages.

Another thing, don’t know if related or not, is that I’m using add_actor() to add the StBoxLayout inside the StScrollView, because using set_child() crashes gnome shell…

EDIT: I’m using Gnome Shell 3.38, since I’m using Debian and still hasn’t updated to 40.

Ok, I found a workaround: I was filling the StBoxLayout() in the “notify::allocation” callback, to fill it with a variable number of columns based on the width. If I just launch in that callback an Idle_add(), filling it during idle time, there are no errors…

But the question is: why does this happen? And also: is this the right way of doing it?

Thanks.

Because you’re creating a layout loop—adding a child to a container causes a relayout, and you’re doing that from inside the layout operation itself.

Using an idle handler is a somewhat okay-ish solution; the appropriate solution is to not add UI elements that determine how big their parent container is from within the code that determines how much space the parent container has at its disposal.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.