Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playlist column widths forgotten on restart #580

Closed
4ndyD opened this issue Jan 7, 2019 · 9 comments
Closed

Playlist column widths forgotten on restart #580

4ndyD opened this issue Jan 7, 2019 · 9 comments

Comments

@4ndyD
Copy link

4ndyD commented Jan 7, 2019

Steps to Reproduce (for bugs)

Quit and re-open Exaile.
This was observed after an upgrade to LM18.3 (based on U16.04) that broke some GStreamer codec plugin dependency for mp3 in the repository-provided version 3.3.2, causing this bug despite all qualities of codec plugins being installed, resulting in me testing the latest version.

Expected Behavior

The playlist columns should be at the same width as they were when the application last ran.

Current Behavior

When Exaile starts after quitting, all columns are at their minimum width (nothing in the column can be read), except for the right-most column, which takes up the rest of the screen width.

Also, sometimes when dragging out the collapsed columns to appropriate widths, as soon as the edge of the last (left-most) column "#" for track number is clicked on, the entire application crashes. This last part has been unreliable - e.g. it happened on the first 2 of 3 times this morning, but I only observed it so far on 4.0.0beta2, currently available as .deb installer via PPA.

There is also slightly different starting visual behaviour - in 4.0.0beta2, all the columns begin collapsed onto the same pixel-width, whereas in 4.0.0rc3, they begin with a few pixels regularly spaced between each column edge.

Environment

Linux Mint 18.3 XFCE 32bit edition
Exaile 4.0.0rc3 from source
GStreamer: 1.8.3
GTK+: 3.18.9
GTK+ theme: Mint-X
Locale: en_GB UTF-8
Mutagen: 1.41.1
PyGObject: 3.20.0
Python: 2.7.12

Peculiarity - I also have Python 3.5 installed, but it seems to be defaulting to 2.7 when running.

I looked at another system already running LM18.3 64bit, and Exaile was not shown in the repository at all. Executing from the github release would not start, probably lacking dependencies.

@sjohannes
Copy link
Member

Hm, I can't reproduce the issue on my system. What I did to test this:

  1. Resize the Artist colum to be very wide.
  2. Restart Exaile.

And the column is still the same width. I also don't encounter the other weirdness that you get.

Could you run Exaile from a terminal and see if there are any error messages displayed?

@4ndyD
Copy link
Author

4ndyD commented Jan 15, 2019

Console output, two errors displayed:

INFO    : Loading Exaile 4.0.0beta2...
INFO    : Using Python 2.7.12
INFO    : Using PyGObject 3.20.0
INFO    : Loading settings...
INFO    : Using Locale en_GB UTF-8
INFO    : Using Mutagen 1.41.1
INFO    : Using GStreamer 1.8.3
INFO    : Reconfiguring crossfading
INFO    : Crossfade: disabled
INFO    : Using GTK+ 3.18.9
INFO    : Loading plugins...
/usr/share/exaile/plugins/notifyosd/__init__.py:26: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded.
  from gi.repository import Notify
INFO    : Loading collection...
INFO    : Loading devices...
INFO    : Connected to udisks2
INFO    : Loading interface...
INFO    : Loading main window...
INFO    : Connecting main window events...
INFO    : Loading panels...
INFO    : Connecting panel events...
INFO    : Done loading main window...
/usr/lib/exaile/xlgui/__init__.py:59: Warning: unable to set property 'rating' of type 'gint' from value of type 'gchararray'
  Gtk.main()

...and on quit:

INFO    : Exaile is shutting down...
INFO    : Disabling plugins...
INFO    : Saving state...
INFO    : Bye!
Exception TypeError: "'NoneType' object is not callable" in <object repr() failed> ignored
Exception TypeError: "'NoneType' object is not callable" in <object repr() failed> ignored

@sjohannes
Copy link
Member

I can reproduce this on Mint 18.3. Column width settings (col_width_title etc.) are saved properly, but the next time Exaile starts they become 3 except for the last column.

Automatic column sizing is not affected by this, so as a temporary workaround you may want to use that (View → Columns → Autosize).

@rokm
Copy link
Member

rokm commented Jan 26, 2019

While #585 fixes the symptoms, it seems to me that the underlying cause of this problem is the delay on the on_width_changed callback (imposed by the glib_wait decorator).

If the decorator is removed, the pattern of on_width_changed invocations changes, and when it is invoked for the first time, the column has correct width (as opposed to 0 which happens on first invocation of delayed version).

Interestingly, the non-delayed handler is called fewer times per column than the delayed one, so there may be a deeper interaction at play here, but so far I haven't been able to figure it out.

@sjohannes
Copy link
Member

The Mint 18.3 machine that I used for testing this just died, so unfortunately it's going to be difficult for me to help now (it doesn't happen on my Arch machine). Let me know if you figure it out or if you don't want #585 merged yet.

@rokm
Copy link
Member

rokm commented Jan 27, 2019

You can merge #585 to have the bug fixed (the additional validation does not hurt anyway).

I will try to instrument the Gtk in my Mint 18.3 VM with some additional traces to see what is going on with the width, but my current hypothesis is that after column notifies us of the width change (with correct width), the width is internally modified/reset without notification (either because the column is being realized or because of resizing/realization of adjacent columns), and with the added delay, we pick up the modified value instead of the one we were supposed to be notified of...

@rokm
Copy link
Member

rokm commented Jan 27, 2019

It seems the above hypothesis is correct. Below are two logs, one with enabled delays and one with disabled delays. Both are obtained with Gtk library that has additional traces in methods that modify GtkTreeViewColumn's width property (prefixed with GTK). And there is an additional trace in exaile in the on_width_changed callback (without any prefix). To reduce verbosity, only Artist and Title columns are enabled.

(I have included full logs here - the relevant part is displayed again at the end of this post).

Delayed version:

INFO    : Loading Exaile 4.0.0rc3+79db176...
INFO    : Using Python 2.7.12
INFO    : Using PyGObject 3.20.0
INFO    : Loading settings...
INFO    : Using Locale en_US UTF-8
INFO    : Using Mutagen 1.31
INFO    : Using GStreamer 1.8.3
INFO    : Reconfiguring crossfading
INFO    : Crossfade: disabled
INFO    : Using GTK+ 3.18.9
INFO    : Using GTK+ theme Mint-X
INFO    : Loading plugins...
INFO    : Loading collection...
INFO    : Loading devices...
INFO    : Connected to udisks2
INFO    : Loading interface...
INFO    : Loading main window...
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 419
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 420
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 419
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 420
INFO    : Connecting main window events...
INFO    : Loading panels...
GTK: gtk_tree_view_column_set_fixed_width, (Filename): setting fixed width: 130
INFO    : Connecting panel events...
INFO    : Done loading main window...
GTK: _gtk_tree_view_column_allocate, (radio): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (radio): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Text): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (Text): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Filename): setting width to: 193
GTK: _gtk_tree_view_column_allocate, (Filename): sending notify::width (current width = 193)!
GTK: gtk_tree_view_column_get_width, (Filename): returning width: 193
GTK: _gtk_tree_view_column_allocate, (Size): setting width to: 37
GTK: _gtk_tree_view_column_allocate, (Size): sending notify::width (current width = 37)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: _gtk_tree_view_column_cell_set_dirty, (): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Artist): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Title): setting width to 0
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 0
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 0)
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 0
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 0
GTK: gtk_tree_view_column_get_width, (Title): returning width: 0
('on_width_changed', TitleColumn('title', u'Title', 200), 0)
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 0
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Tag): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Podcast): setting width to 0
GTK: _gtk_tree_view_column_allocate, (radio): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (radio): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Text): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (Text): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Filename): setting width to: 193
GTK: _gtk_tree_view_column_allocate, (Filename): sending notify::width (current width = 193)!
GTK: gtk_tree_view_column_get_width, (Filename): returning width: 193
GTK: _gtk_tree_view_column_allocate, (Size): setting width to: 37
GTK: _gtk_tree_view_column_allocate, (Size): sending notify::width (current width = 37)!
GTK: _gtk_tree_view_column_allocate, (Tag): setting width to: 236
GTK: _gtk_tree_view_column_allocate, (Tag): sending notify::width (current width = 236)!
GTK: _gtk_tree_view_column_allocate, (Podcast): setting width to: 228
GTK: _gtk_tree_view_column_allocate, (Podcast): sending notify::width (current width = 228)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 3
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 3)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 836
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 836)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 3
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 3)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 836
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 836)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 3
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 3)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 836
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 836)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 3
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 3)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 836
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 836)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 3
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 3)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 836
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 836)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 3
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 3)
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 3
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 3
GTK: gtk_tree_view_column_get_width, (Title): returning width: 836
('on_width_changed', TitleColumn('title', u'Title', 200), 836)
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 836
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 836
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 3
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 3)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 836
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 836)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 3
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 3)
GTK: gtk_tree_view_column_get_width, (Title): returning width: 836
INFO    : Exaile is shutting down...
INFO    : Tearing down plugins...
INFO    : Saving state...
INFO    : Bye!
('on_width_changed', TitleColumn('title', u'Title', 200), 836)

Non-delayed version:

INFO    : Loading Exaile 4.0.0rc3+79db176...
INFO    : Using Python 2.7.12
INFO    : Using PyGObject 3.20.0
INFO    : Loading settings...
INFO    : Using Locale en_US UTF-8
INFO    : Using Mutagen 1.31
INFO    : Using GStreamer 1.8.3
INFO    : Reconfiguring crossfading
INFO    : Crossfade: disabled
INFO    : Using GTK+ 3.18.9
INFO    : Using GTK+ theme Mint-X
INFO    : Loading plugins...
INFO    : Loading collection...
INFO    : Loading devices...
INFO    : Connected to udisks2
INFO    : Loading interface...
INFO    : Loading main window...
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 419
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 420
GTK: gtk_tree_view_column_set_fixed_width, (Artist): setting fixed width: 419
GTK: gtk_tree_view_column_set_fixed_width, (Title): setting fixed width: 420
INFO    : Connecting main window events...
INFO    : Loading panels...
GTK: gtk_tree_view_column_set_fixed_width, (Filename): setting fixed width: 130
INFO    : Connecting panel events...
INFO    : Done loading main window...
GTK: _gtk_tree_view_column_allocate, (radio): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (radio): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Text): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (Text): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Filename): setting width to: 193
GTK: _gtk_tree_view_column_allocate, (Filename): sending notify::width (current width = 193)!
GTK: gtk_tree_view_column_get_width, (Filename): returning width: 193
GTK: _gtk_tree_view_column_allocate, (Size): setting width to: 37
GTK: _gtk_tree_view_column_allocate, (Size): sending notify::width (current width = 37)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
('on_width_changed', TitleColumn('title', u'Title', 200), 420)
GTK: _gtk_tree_view_column_cell_set_dirty, (): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Artist): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Title): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Tag): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Podcast): setting width to 0
GTK: _gtk_tree_view_column_allocate, (radio): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (radio): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Text): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (Text): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Filename): setting width to: 193
GTK: _gtk_tree_view_column_allocate, (Filename): sending notify::width (current width = 193)!
GTK: gtk_tree_view_column_get_width, (Filename): returning width: 193
GTK: _gtk_tree_view_column_allocate, (Size): setting width to: 37
GTK: _gtk_tree_view_column_allocate, (Size): sending notify::width (current width = 37)!
GTK: _gtk_tree_view_column_allocate, (Tag): setting width to: 236
GTK: _gtk_tree_view_column_allocate, (Tag): sending notify::width (current width = 236)!
GTK: _gtk_tree_view_column_allocate, (Podcast): setting width to: 228
GTK: _gtk_tree_view_column_allocate, (Podcast): sending notify::width (current width = 228)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
('on_width_changed', TitleColumn('title', u'Title', 200), 420)
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
('on_width_changed', TitleColumn('title', u'Title', 200), 420)
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
('on_width_changed', TitleColumn('title', u'Title', 200), 420)
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
('on_width_changed', TitleColumn('title', u'Title', 200), 420)
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
('on_width_changed', TitleColumn('title', u'Title', 200), 420)
GTK: _gtk_tree_view_column_allocate, (radio): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (radio): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Text): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (Text): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Filename): setting width to: 193
GTK: _gtk_tree_view_column_allocate, (Filename): sending notify::width (current width = 193)!
GTK: gtk_tree_view_column_get_width, (Filename): returning width: 193
GTK: _gtk_tree_view_column_allocate, (Size): setting width to: 37
GTK: _gtk_tree_view_column_allocate, (Size): sending notify::width (current width = 37)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
('on_width_changed', TitleColumn('title', u'Title', 200), 420)
GTK: _gtk_tree_view_column_allocate, (radio): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (radio): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Text): setting width to: 230
GTK: _gtk_tree_view_column_allocate, (Text): sending notify::width (current width = 230)!
GTK: _gtk_tree_view_column_allocate, (Filename): setting width to: 193
GTK: _gtk_tree_view_column_allocate, (Filename): sending notify::width (current width = 193)!
GTK: gtk_tree_view_column_get_width, (Filename): returning width: 193
GTK: _gtk_tree_view_column_allocate, (Size): setting width to: 37
GTK: _gtk_tree_view_column_allocate, (Size): sending notify::width (current width = 37)!
GTK: _gtk_tree_view_column_allocate, (Tag): setting width to: 236
GTK: _gtk_tree_view_column_allocate, (Tag): sending notify::width (current width = 236)!
GTK: _gtk_tree_view_column_allocate, (Podcast): setting width to: 228
GTK: _gtk_tree_view_column_allocate, (Podcast): sending notify::width (current width = 228)!
GTK: _gtk_tree_view_column_allocate, (): setting width to: 13
GTK: _gtk_tree_view_column_allocate, (): sending notify::width (current width = 13)!
GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: gtk_tree_view_column_get_width, (Title): returning width: 420
INFO    : Exaile is shutting down...
INFO    : Tearing down plugins...
INFO    : Saving state...
INFO    : Bye!
('on_width_changed', TitleColumn('title', u'Title', 200), 420)

The relevant part is

GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: _gtk_tree_view_column_allocate, (Title): setting width to: 420
GTK: _gtk_tree_view_column_allocate, (Title): sending notify::width (current width = 420)!
GTK: _gtk_tree_view_column_cell_set_dirty, (): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Artist): setting width to 0
GTK: _gtk_tree_view_column_cell_set_dirty, (Title): setting width to 0
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 0
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 0)

for delayed version vs.

GTK: _gtk_tree_view_column_allocate, (Artist): setting width to: 419
GTK: _gtk_tree_view_column_allocate, (Artist): sending notify::width (current width = 419)!
GTK: gtk_tree_view_column_get_width, (Artist): returning width: 419
('on_width_changed', ArtistColumn('artist', u'Artist', 150), 419)

for the non-delayed one.

The _gtk_tree_view_column_allocate() sets the width to the desired value, performs allocation and resizing, and emits the notify::width signal - at which point, the width has the desired value. In non-delayed version, we pick up the correct value in on_width_changed; in the delayed version, however, a _gtk_tree_view_column_cell_set_dirty() resets the width to 0 before on_width_changedis invoked, and we end up with width of 0.

So I would say that the proper fix is to remove the delay - unless we have it there for a specific reason?

@sjohannes
Copy link
Member

The delay is meant to prevent excessive processing. common.glib_wait(100) means that if the function gets called again within 100 ms, the first call is dropped. If the function gets called again within 100 ms of the second call, the second call is dropped.

I think the idea here is that settings.set_option may be somewhat expensive, so when the user is resizing a column by dragging the column separator we don't want to call it too often.

Perhaps a better fix is to call get_width without delay, but delay the set_option call. Something like this:

def on_width_changed(self, column, widget):
    self._delayed_width_changed(self.get_width())

@common.glib_wait(100)
def _delayed_width_changed(self, width):
    if not self.destroyed and width != settings.get_option(
        self.settings_width_name, -1
    ):
        settings.set_option(self.settings_width_name, width)

@rokm
Copy link
Member

rokm commented Jan 28, 2019

Indeed, that should both fix the problem and preserve the delayed behaviour.

sjohannes added a commit to sjohannes/exaile that referenced this issue Feb 5, 2019
When the delayed/batched function gets called, the widget may be in an
inconsistent state. On some older GTK+ versions (e.g. 3.18.9 on Linux Mint)
this resulted in column widths of 0 to be saved on startup.

This change calls get_width immediately in the signal handler and passes
the value to the delayed function.

Fixes: exaile#580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants