Comment 351 for bug 195698

Revision history for this message
In , Mrlint+bugzilla (mrlint+bugzilla) wrote :

(In reply to comment #225)

Brian,

Of course I know you aren't posting real code, but one thing I'd like to add is not only if the dialog is active, but if a dialog is active for the same credentials. For which possibilities can be reduced by inspecting the server and port asking for credentials.

> Maybe I am stating the obvious, and I have definitely not looked at the source,
> but from a code point of view, it seems to me that these various input routines
> need to be "global" in nature (in reference to all of the threads that multiple
> tabs create) and needs to function in such a manner, assuming a tab calls such
> a globally aware "get_password()" function:
>
> char * get_password() {
>
> static int dialog_active = false;
> static char *password = NULL;
>
> if (password)
> return password;
>
> if (dialog_active)
> while (!password)
> sleep(1);
> else
> password = password_dialog();
>
> return password;
>
> }
>
> The spinloop on password is lame, I know, but I am sure somebody more familiar
> with the toolkit can come up with some form of non-spinning wait.
>
> And of course, as always, the devil is in the details... :-)