Don't crash when background listing outlasts file manager list job
When the QDir listing in the background thread takes a long time, e.g. by artificially introducing a sleep statement therein, then it can happen that the FileManagerListJob gets destroyed before the background task finishes. If that happens, then we used to access the dangling this pointer to access m_aborted or to invoke the handleResults method, both of which are undefined behavior. The latter usually crashes. Prevent this from happening by introducing a mutex that gets locked while we are running a background task and during destruction of the list job. This synchronizes the two tasks and prevents the crash from happening.
Showing with 14 additions and 0 deletions