jeromerobert / k4dirstat

K4DirStat (KDE Directory Statistics) is a small utility program that sums up disk usage for directory trees, very much like the Unix 'du' command. It displays the disk space used up by a directory tree, both numerically and graphically (copied from the Debian package description).
GNU General Public License v2.0
64 stars 10 forks source link

Fix crashes on startup on Debian #27

Closed jpalecek closed 4 years ago

jpalecek commented 4 years ago

Hello,

I am experiencing k4dirstat crashes on every startup, with k4dirstat installed from official Debian packages. This is the backtrace

After very painful debugging, it became clear that QStandardItemModel::itemFromIndex was being called with a QModelIndex argument that didn't originated in a QStandardItemModel at all, but rather, in a KDirModel from KIO. The reason for this was that KSortFiterProxyModel from kdirtreeview.cpp got mixed up on linking with KSortFilterProxyModel from KIO.

To fix this, I moved all definitions fro kdirtreeview.cpp to the namespace KDirStat. This was probably already intended, but it hasn't been executed thoroughly. With this change, k4dirstat runs fine.

Note, that using namespace XXX is a code smell and you problably don't want it in any code. I suggest enclosing your definitions in namespace XXX { ... } should be done in the other source files as well, although I only had problems with this one.

After you've fixed this, please release the corrected version to Debian.