Do I understand correctly that XSynchronize gives us an exclusive lock on screen interaction? From the man page, it looks like it should be released. Does XCloseDisplay do that? Then a comment near XCloseDisplay should clarify that.
In any case, if it's a lock, we shall try and hold it for the shortest duration possible. File access can be slow depending on circumstances and storage medium. We should thus load the image data earlier, ideally even before we interact with X at all, because failure to load the icon voids any usefulness of the X interaction. And since X interaction always carries risks of bad side effects¹, we should be very conservative about them.
(¹ I'm currently a victim of bad xdotool freezes that neither me nor IRC can trace even after many hours of debugging.)
Do I understand correctly that XSynchronize gives us an exclusive lock on screen interaction? From the man page, it looks like it should be released. Does XCloseDisplay do that? Then a comment near XCloseDisplay should clarify that.
In any case, if it's a lock, we shall try and hold it for the shortest duration possible. File access can be slow depending on circumstances and storage medium. We should thus load the image data earlier, ideally even before we interact with X at all, because failure to load the icon voids any usefulness of the X interaction. And since X interaction always carries risks of bad side effects¹, we should be very conservative about them.
(¹ I'm currently a victim of bad
xdotool
freezes that neither me nor IRC can trace even after many hours of debugging.)