nfd_gtk – perform all GTK+ operations in a forked process #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this pull request covers a small patch that augments the GTK+ code with a forking wrapper. This essentially encapsulates everything GTK+ into a separate process. Aside solving the GTK+ deinitialization issue this also improves robustness of the host program: If anything on the GTK side crashes the process (for example a bug in a thumbnail generator or similar), only the process dedicated to the file dialog goes down and the host process sees an error. Another benefit of forking the file dialog is, that in case a networked file system is accessed and the network blocks one can kill the file dialog process without tearing down the host.
Q&A:
Yes, the file dialog process exits without freeing the buffers it created. That would be like giving a house a cleanup and paint job just before the demolishion crew goes to work.
Yes, the pipe is accessed by literally the very same binary (with identical virtual addresses for everything) that runs in two separate processes and the pipe transfers simply connect identical memory layouts of objects on both processes. There's no need for a descriptive serialization format here. Admittedly, someone could inject nonsense into /proc/fd/${PIPE} but there are easier ways to mess up things.