Diffusion Juk a800c1b3ffeb

playlist: Don't rely on overridden column count during construction.

Authored by mpyne on Feb 23 2020, 7:56 PM.

Description

playlist: Don't rely on overridden column count during construction.

The LGTM code scanning site has coverage of JuK by virtue of its Github
mirror, and reported [1] that Playlist was calling a function that was
indirectly reliant on a virtual function (columnOffset()) that is
overridden by subclasses like HistoryPlaylist.

This is a bug since the C++ language specifies that a superclass
constructor will be statically bound to call its own version of a
virtual function (or an even higher superclass's), rather than whatever
the subclass reimplementation might ultimately be.

This is fixed by using the data we already have at the time of
construction to set aside the right number of columns and then just
holding onto the header labels generated rather than trying to
introspect later.

[1] https://lgtm.com/projects/g/KDE/juk?mode=list

Details

Committed
mpyneFeb 23 2020, 7:56 PM
Parents
R344:64b95b30c768: ui: Fix bug in scrolling from playlist to search line.
Branches
Unknown
Tags
Unknown

This introduced a possible regression, could you please have a look at it: https://bugs.kde.org/show_bug.cgi?id=420718

mpyne added a comment.May 10 2020, 4:00 PM

This introduced a possible regression, could you please have a look at it: https://bugs.kde.org/show_bug.cgi?id=420718

Thanks @markusxx I have confirmed your patch addresses this and applied it to the JuK codebase. Should be just in time for tagging tomorrow to go out with the 20.04.1 release. Sorry for the delay on this! :(