Brad Sawatzky <[EMAIL PROTECTED]> wrote:
> everything would just work. However, if you use gdb to break on writes to
> the memory location stored during the initial "menu_items[i].label =
> str_list[i];" line (in the unpatched xsane-front-gtk.c:xsane_option_menu_new()
> function) you should find that it gets overwritten regularly as data are
> transferred through the net backend.
Hmm, on second thought, it doesn't nail it down that clearly after
all. It's actually OK to have this memory overwritten when the net
backend is refreshing the option descriptors.
What's not so much OK is that the net backend can refresh the option
descriptors behind XSane's back in sane_control_option(). I think it
shouldn't do that and just error out.
But if the option descriptors are invalid (ie the backend told the
frontend that it needed to reload the options after setting an option)
at the start of sane_control_option() that's a bug in XSane that
failed to acknowledge and act upon the backend's request to reload the
option descriptors.
Could you try to check if that matches what you're seeing?
Other than that, I think the net backend does the right thing. It
presents a local copy of the option descriptors to the frontend,
providing a stable memory address for the option descriptors.
Anything in the option descriptor can change after the backend tells
the frontend to reload the options, and I think that's what you're
seeing with gdb when the net backend refreshes the option
descriptors. But the memory allocated by sanei_wire for the option
descriptors and their content should not get overwritten unless
there's been a call to sane_get_option_descriptor().
The code flow looks roughly like this:
frontend calls sane_get_option_descriptor() for first option
net backend loads option descriptors (fetch_options())
frontend calls sane_get_option_descriptor() a few more times to load all options
frontend sets an option value by calling sane_control_option()
net backend forwards to underlying backend
underlying backend replies with info containing SANE_INFO_RELOAD_OPTIONS
net backends marks local copy as invalid, forwards to frontend
frontend calls sane_get_option_descriptor() for first option
net backend loads option descriptors (fetch_options())
frontend calls sane_get_option_descriptor() a few more times to reload all the
options
Pity I don't have the hardware to reproduce this issue here.
Now, two scenarios:
- there's a bug somewhere and the memory allocated by sanei_wire gets
overwritten for some reason, which shouldn't happen
- there's a bug in XSane not acting upon SANE_INFO_RELOAD_OPTIONS
Do you think you can try to determine which one is actually happening?
JB.
--
Julien BLACHE - Debian & GNU/Linux Developer - <[EMAIL PROTECTED]>
Public key available on <http://www.jblache.org> - KeyID: F5D6 5169
GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]