Use _exit instead of exit not to run atexit handlers in case execvp() fails.
This change is definitely not correct.
A child process exited with 1 as result but it wasn't an error case.
it is an error case: the execv*() family  of functions replaces the execution with the requested process, and never return in a successful execution. "successful execution" means that the process was started correctly, no matter its resulting exit code. Anything after execv*() will be processed only if it fails, and one of the most common issues is that the requested executable does not exists.
In addition to this, your case merely changes the exit() code, still calling exit() (which appears in the backtraces of the two bugs, and most probably one can be marked as duplicate of the other). The issue here is that fork() clones the calling process (in this case kdeinit), including the atexit handlers: apparently a mesa atexit handler is run... The real fix in this case is to use _exit() , which is a more direct way to exit the current process without running the atexit handlers.
Furthermore, this code looks like a C snippet to invoke a process and reading its stdout retrofitted as ThumbCreator plugin... sadly C is not an easy language, and the process APIs are complex and very prone to mistakes. The ideal solution would be to invoke ddjvu using QProcess, and read its output as it comes; it would also have the (small) advantage of making this thumbnailer plugin available on any platform, Windows included (in case anyone cases, that is).
Let me sum up what I think is the approach to make this ThumbCreator work properly:
Please update the text of the revision and the commit message, as they don't make much sense. Please mention that it fixes a crash in case ddjvu is not installed, by avoiding executing it, and using _exit() to not run atexit handlers in case execvp() fails.
Also, please respect the indentation of the code: 2 spaces, and no brackets for a single instruction in a block.
I wrote it two times to land this on the stable branch: the first time when I explained why the initial patch was not correct and what the problem actually was (with hints on short term and long term fixes), and earlier today when I wrote:
There is no need to "deduce" anything, just read what I wrote, thanks.
If this is ready approve and add a comment "land to 20.04".
The commit message still says "20.08", so not yet.