Skip to content
  • Michael Pyne's avatar
    playlist: Don't rely on overridden column count during construction. · a800c1b3
    Michael Pyne authored
    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
    a800c1b3