Use only one "directory contents counting" thread per process

Review Request #115064 - Created Jan. 17, 2014 and submitted

Information
Frank Reininghaus
kde-baseapps
master
Reviewers
dolphin
Since https://git.reviewboard.kde.org/r/111920/, we use a separate thread for counting the items inside directories (e.g., for the "Size" column in Details View) to prevent that the GUI is blocked while handling large directories. However, this means that Dolphin now uses quite a lot of threads if there are many views. To see that, run Dolphin in gdb, open many tabs with Ctrl+T, and check the output of "thread apply all backtrace.

I propose to make all views share the same thread. The QThread object is stored in a global variable, and each view increments/decrements a reference count when it starts/stops using the thread. If this thread reaches zero, the thread is stopped.
Opening new views does not start new threads any more. The "Size" column in Details view still works normally for me.
Mark Gaiser
Emmanuel Pescosta
Commit Hook
Frank Reininghaus
Review request changed

Status: Closed (submitted)

Loading...