Skip to content
Commit d15622e1 authored by Bart De Vries's avatar Bart De Vries
Browse files

Fix deadlock when closing gwenview importer

When gwenview_importer is closed after importing files, it gets into a
deadlock.  This bug was introduced in commit 4f7d35d1 by the refactoring
of thumbnailprovider and thumbnailgenerator.

The deadlock is caused by the fact that closing the application will
directly trigger a wait() in the thumbnailgenerator thread which will
wait on proper closure of this thread before allowing the application to
exit.  However, this thumbnailgenerator thread is, at that moment, in a
QWaitCondition state which is intended to wait on new thumbnails to be
generated.
As far as I can see, this is not a problem in the main gwenview
application because the deadlock will eventually be lifted by the
destruction of the thumbnailgenerator object by the chain of destructors
going from application level down to thumbnailprovider which is the
owner of this object.
In the importer the situation is a bit different.  After importing has
finished, the thumbnailpage which is the owner of thumbnailprovider
is not the current widget anymore.  It still exists in the background in
case the user presses the "Import more Documents" button.  For some
reason the destruction chain doesn't seem to properly trigger the
cancel() function of the thumbnailgenerator object/thread.

The simple solution is to call the cancel() function just before the
wait() function is called when the application emits aboutToQuit().
This is proper behavior, since the thumbnailgenerator should always be
triggered to close down when the application is quitting.

BUG: 425971
parent d36d2ba6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment