lwindolf / liferea

Liferea (Linux Feed Reader), a news reader for GTK/GNOME
https://lzone.de/liferea
GNU General Public License v2.0
815 stars 130 forks source link

Strange adaptive UI layout panes behavior on the very first startup with version 1.14.0 #1192

Open nekohayo opened 1 year ago

nekohayo commented 1 year ago

Congratulations on the 1.14 release! I saw this line in the release notes:

New view mode 'Automatic' which switches between 'Normal' and 'Wide' mode based on the window proportions.

2-pane mode was removed

This sounds like it tries to make a first attempt at implementing at least one of the ideas from #889... I was very curious to try it out now, so I grabbed @bbhtt's test flatpak build from https://github.com/flathub/net.sourceforge.liferea/pull/11#issuecomment-1379343285 and installed it (probably within a few hours it will just show up on flathub itself), and launched the app to try out this new feature.

I ran into a weird bug that occurs only on the first launch with a fresh liferea data profile (it helps that I installed it as a flatpak, so it's completely independent/parallel to my system install): the vertical pane does not appear when the window is wide enough, even though the listview switches modes. Maybe some sort of race condition with the panes display or resizing logic?

Here is a video to better explain the weirdness (and to have some proof that it exists :)

liferea 1.14 fresh install window sizing layout switching bug.webm

It occurred both on Xorg with open source AMD Radeon graphics, and on Wayland with Intel Kaby Lake graphics. Here's the console output as it happened...

First startup on Xorg (GNOME 43)

(liferea:2): Gdk-CRITICAL **: 19:10:06.481: gdk_pixbuf_get_from_surface: assertion 'width > 0 && height > 0' failed
(this line above was repeated 42 more times within the span of 1 second)

sys:1: Warning: g_value_get_pointer: assertion 'G_VALUE_HOLDS_POINTER (value)' failed
ONLINE!!!!!!!!!!!!!!!!

First startup on Wayland (GNOME 43)

(liferea:2): Gdk-CRITICAL **: 19:18:57.473: gdk_pixbuf_get_from_surface: assertion 'width > 0 && height > 0' failed
(liferea:2): Gtk-CRITICAL **: 19:18:57.473: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed

These two lines were repeated 55 more times within the span of 5 seconds. On subsequent startups, there were no more such warnings.


In both cases, on the 2nd and subsequent startups, Liferea behaved "correctly" in the sense that it was now able to display the vertical pane when the window is wide enough. So in essence, the workaround is "launch Liferea more than one time in your life", but I thought I'd report this bug anyway because 1) it might hurt initial (out-of-the-box) user experience, and 2) oftentimes, this is the symptom of some other bug that may be due to a race condition or something with the way settings are handled, that may resurface at some other time (or different conditions) and bite us in the arse, so I believe it's safer to report this sooner than later ;)

If you want to reproduce this issue, you probably want to be running a clean install using flatpak, and nuking all the config and data of that contained instance between tries, to have a "clean laboratory" environment on every launch... with the flatpak approach, you could experiment more cleanly because you're not touching your real data from the system-installed version provided by your distro.


Thank you for your work, and I look forward to further improvements to the views, such as fixing row heights in widescreen mode, and perhaps an "ultra-narrow" automatic view mode someday :)

kevinquillen commented 1 year ago

This started happening to me out of nowhere. How can I fix it? I don't want an adaptive mode.

nekohayo commented 1 year ago

In my view, the proper approach is to find and fix the small bug in the layout detection / timing, not throw away the whole implementation.

kevinquillen commented 1 year ago

Great, but this was usable until today. I just don't want it to attempt to resize like that. Is this a feature flag I can toggle? Otherwise the app is not usable for me on Fedora 37 because its stuck with the giant display and never shows me the normal list mode like it used to.

nekohayo commented 1 year ago

Hmm, I don't know if this can be simply toggled off (but I doubt it, in this particular case). This is why I stuck to version 1.13.x until this (and particularly issue #534*) is fixed. Theoretically, I think it would be possible for you to dnf downgrade liferea && dnf versionlock liferea as a workaround maybe (presuming the data file formats etc. haven't changed... maybe backup your data before doing that) while investigating this.

I'd like to get this investigated and fixed... so my first question is, does this happen for you 100% of the time, even after restarting the app, even after a logout/relogin / full reboot (this sounds stupid but... in my case the issue disappeared after the first occurrence, so I was no longer able to reproduce it)?

My second question is, if it's reproducible, whether you or one of the developers could pepper the code with debug statements to narrow down where the problem happens (wouldn't surprise me if this was a race condition). I don't have the knowledge to do that personally.


*: I had provided a theoretical fix for some of issue 534, mentioned in this comment, but I think this got forgotten / nobody bothered to test that potential fix... at this point it's so old, I don't know if @lwindolf can still make use of it!

lwindolf commented 1 year ago

@kevinquillen You can disable the auto layout behaviour in the preferences (tab "Headlines"). Just set the default mode to "Normal" or "Wide" instead of "Automatic".

lwindolf commented 1 year ago

@nekohayo I failed to reproduce it so far. But I have an idea.

Can you please run with

  liferea --debug-gui | grep "Restoring pane proportions"

and post the result?

My suspicion is:

  1. Startup happens
  2. Window orientation for non-3 pane is chosen per default
  3. liferea_shell_restore_layout() triggers, performs anti zero width sanity checks
  4. Auto layout change view style to another layout

and in the end the sanity check for 0 width was done for the wrong layout. This also explains why it works on 2nd start where the correct layout is initialized before step 3.)

lwindolf commented 1 year ago

Just to be safe I've moved pane restoration until after all widgets are created: ed860fa4.

lwindolf commented 1 year ago

Another fix for the pane layout handling https://github.com/lwindolf/liferea/commit/3782fef1be2311fd89ffb1a8df320566b4496d4c

lwindolf commented 11 months ago

Above commit fixes another condition that panes can go invisible on window maximizing.