Don't crash when background listing outlasts file manager list job

Authored by mwolff on Feb 10 2019, 10:39 AM.

Description

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.

Details

Committed
mwolffFeb 13 2019, 8:37 AM
Parents
R32:3aed7ac41a67: Don't crash when project is closed before it was fully opened
Branches
Unknown
Tags
Unknown
arrowd added a subscriber: arrowd.May 2 2019, 3:10 PM

This commit introduced a crash in some tests on FreeBSD. The m_listing mutex gets locked twice by the same thread causing deadlock exception.