Hi everyone,

I was poking through the dockaps repo and stumbled upon wmbutton, an
application I have fond memories of, which I stopped using at some
point for reasons that I don't remember right now (my short hiatus to
ratpoison land might have been involved).

Anyway, I took a few minutes to fix a bug that
2001-just-saw-linux-for-the-first-time me remembers not quite fondly.
wmbutton will happily start and display what looks like a functioning
screen (all it has to do is paint an xpm in order to do that), even if
it can't load its configuration file. As soon as it has to display a
tooltip or react to a mouse click, though, it will exit, because it
only attempts to decode the configuration file (which includes tooltips
and commands) at that point.

Output is shown on the terminal, assuming the application is ran from
one, so the problem can be diagnosed by a careful user. However, if
something happens to a regularly-used configuration file (user deletes
it by mistake?), there's a good chance the application isn't ran from a
terminal (more likely, it's automatically started when WMaker starts),
so it looks like it crashes. It's also pretty much bad taste to start
an application that can't do anything anyway.

My patch just makes it bail out early. It checks that at least one
configuration file can be open, and exits immediately if all the checks
fail. The verification itself is not quite optimum, but it's used in
other places in the source code; I prefer to give the original author
the benefit of the doubt. I haven't looked at the code for more than
fifteen minutes, so I'd rather not slash it too radically.

A *better* fix, of course, would be to also display some sort of
graphical error message (exiting in a crash-like manner is only a
little worse than silently not starting at all!). I'll try to hack that
up when I get some time to remember all that Xlib madness, which I
haven't touched in ten years I think; I'd rather not tie it to a
graphical toolkit, not even WINGs, since there might be users who want
to run wmbutton under something other than WindowMaker.

Needless to say, any comments or suggestions are very much appreciated,
especially since I'm not familiar with the application's (admittedly
short) source code.

Thank you!
-- 
Ioan-Alexandru Lazar |   o
<[email protected]> |     o
Computer Engineer    | o o o

Attachment: 0001-wmbutton-fail-early-on-missing-config.patch
Description: Binary data

Reply via email to