A possible fix for GeekTool image display crashes

Jan 13, '05 07:17:00AM

Contributed by: Anonymous

After reading a lot about GeekTool crashing, and after having experienced this myself, I found from CrashReporter logs that GeekTool always died in the same OS routine, obviously displaying a picture. I attributed this to the picture being overwritten at the time it is displayed. Based on this assumption, I changed my GeekLog code from:

gm convert .... result.gif; your graphics utility here
to
gm convert .... tmp.gif;  your graphics utility here
mv tmp.gif result.gif
This cured all my frequent crashes. I only have limited UNIX knowledge, but the first version above sure might yield a corrupted image being displayed. In the new version, the mv command will not overwrite the previous version of result.gif. Once result.gif is opened for display, it will stay intact, until it is closed again. If the mv occurs while the file is open, it will be replaced immediately in the directory ... but unlinking of the open file will be deferred, until Geektool closes it.

This technique is not limited to GeekTool; it should always be used when files might get overwritten during parallel processing by some other program. Hope this helps!

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050111084206580