I experience an strange issue with a gtk4 panned window, where one pane contents is at random disappearing and showing again when moving the pane divider, updating anything (typing into a entry) or adjusting the window size.
I noted this seams only to happen on X11 and not when running the app on Wayland.
I could provide a trivial example window (canvas left, notebook right), but likely not happening then as in a trivial context. And not sure how much of actions/updates I need to add to reproduce it…
But I do see a ton of those mysterious “trying to snapshot GtkNotebook 0x… without a current allocation” Warnings. What is that meaning, sounds like some bogus data management?!?
Happens at random when anything if been forced to be refreshed as of changes. (from gtk main, but triggered by other GUI callbacks)
On Wayland it only gets blanc briefly but comes back I noted.
Never had any issue with Gtk3 with the same context and program “logic”.
Yes one: I use queue_draw for elements within my canvas/drawing area when they need to move/update or change. And for example a change of a value on “left side” will trigger a redraw or queue_draw to refresh the image for example.
Solution:
I found out what caused this…
a) when I did not run my GtkDrawingAreaDrawFunc (or skipped it) the issue did NOT occur any more.
For a test I put this bail out code into it, so after 20 updated it stops do anything and no weird behavior any more:
static int once=0;
if (++once > 20) return;
g_message("CDF #%d", once);
b) I realized I did triggered from within my drawing_function also the update of few gtk_entries what caused to call gtk_entry_set_text()…. this seamed to be not a good idea to do any more!
c) Instead I safe guarded/delayed this action via “only” issuing a g_idle_add to do that task when ever is possible later: