[sane-devel] Bug in net.c sane_exit

George Garvey tmwg-sane at inxservices.com
Fri Feb 21 16:36:57 GMT 2003


On Fri, Feb 21, 2003 at 04:13:21PM +0100, Henning Meier-Geinitz wrote:
> On Thu, Feb 20, 2003 at 04:14:51PM -0800, George Garvey wrote:
> >    Doesn't set global variables to NULL.
> Right. I'm curious: Which frontend are you using? Most frontends don't
> call sane_exit and then sane_init again, as far as I know, that's why
> I'm asking.

I'm linking libsane-net into our in-house developed contact manager. It
tends to be run by users all day long. The scanner will only
occasionally be used. So I chose to call sane_exit after their "last"
scan, since it may be hours (or minutes, no way of knowing) until they
want to scan again.

It may have been over cautious, but I was concerned about using up
resources by leaving sane initialized. From a cursory look, it appears
that a connection to saned is kept open, and may lock the scanner used
(of that I'm not certain -- sane_close may free up the scanner -- I
didn't investigate that closely enough to say).

> Thanks for your patch. Can you try this alternative one (against
> current CVS)? I think it's more obvious to initialize in sane_init.

That works, too. The rest of the devices probably need to be checked for
this, since as you say, normal frontends are scan only programs and
don't do this.



More information about the sane-devel mailing list