Skip to content

Wait for end of all jobs before exit

Marek Kašík requested to merge mkasik/evince:wait-for-threads into main

This merge request fixes #1713 (closed) for me. It waits until all jobs are done before quitting main(). This avoids access to globalParams of poppler since it is possible that it has been already destroyed in exit handlers but some jobs are still accessing it.

To easily reproduce this you need to delay execution of an operation in poppler. I've chosen the NameToCharCode::lookup(), I add 10 micro seconds delay to its while cycle via usleep(10). Then it is enough to quickly close evince window once it shows up during start. It is not 100% but good enough.

I've tried to fix this in poppler but it is much easier and more appropriate at evince.

Regarding the implementation, I've added the g_usleep() to the while cycle of the ev_job_scheduler_wait() function because e.g. valgrind does not quit without it.

See #1713 (closed) and https://gitlab.freedesktop.org/poppler/poppler/-/issues/1243 for additional info.

Merge request reports