Ported code base from GTK3 to GTK4 -> dialogs freeze up

I want to ask for hints on a problem I have converting the Liferea GTK3 code to GTK4. My problem is that dialogs when created are partially frozen. Callbacks from signals are triggered, but the UI does not change (entries not showing characters, button sensitivity does not change, hover effects do not show…).

This is a race condition because it does not always happen.

When creating the dialogs

  • UI is loaded from GtkBuilder resource
  • the code properly sets the transient window
  • and uses gtk_window_present() to show them

What I tried

  • I tried creating them with g_idle_add() → then it happens less often
  • I tried setting dialogs modal → doesn’t change behaviour

I’m guessing there is a problem with the main loop. Network access in Liferea is done using libsoup3 and should be asynchronous though.

I’d be happy about any hints!

Hi,

Are they native dialogs, or derived from Gtk.Dialog?
Pure gtk4, or libadwaita?

One issue I faced when porting apps to gtk4 was the fact that native dialogs references are not hold by gtk internally, so I had to manually keep a ref until they were closed. I remember of weird bugs when no refs were kept.

Thanks for working on Liferea, it’s a great app, I’m using it since ages :slight_smile:

The code is pure GTK4 so just a Gtk.Dialog.

I did try to extra-reference it, but this did not help.

What I found out by experimenting, that when I do not set the dialog transient to the main window then the issue is 100% gone. Of course this is not the way to do it…

I’m glad Liferea has been useful for you for a long time!

Have you dropped the old mainloop-blocking APIs like gtk_dialog_run , and use the response signal instead?

Hmm…weird

By the way, which gtk4 version? x11 or wayland?

I have no gtk_dialog_run() in the code and use the response callback everywhwere.

Version wise I’m on Ubuntu with

 libgtk-4-1:amd64           4.16.3+ds-0ubuntu

I’m only working in Wayland. I tested in a X11 session where the problem does not appear.

Sounds like a renderer issue. I remember similar glitches were reported on gtk bug tracker with some GPU drivers (nvidia, amdvlk, old intel cards).

You can try to set one of these env variables to see if it improves:
GSK_RENDERER=cairo
GDK_DISABLE=dmabuf
GDK_DISABLE=vulkan

I promise to test this soon! Thank you for this hint.

1 Like

Argh… updated to Ubuntu 25.04 with GNOME 48 and the effect is gone :expressionless_face:

1 Like

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