After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 565110 - Need a way to allow applications to choose not to load gail during startup
Need a way to allow applications to choose not to load gail during startup
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Accessibility
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-12-19 17:39 UTC by Brad Taylor
Modified: 2009-01-08 14:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch against gtk 2.14.4 (864 bytes, patch)
2008-12-19 17:41 UTC, Brad Taylor
reviewed Details | Review

Description Brad Taylor 2008-12-19 17:39:11 UTC
Similar to #563943, If an app needs to load atk-bridge to export its Atk objects but not Gail as it uses Gtk+ only for themeing, an enviroment variable should be added to stop Gail from loading.

The specific instance I'm dealing with is around Mono's System.Windows.Forms implementation.  Right now, it links to gtk+ for theming purposes (similar to Firefox and OpenOffice), and as a result, Gail and atk-bridge are loaded.  In our instance, that causes Gail to register our window sooner than the SWF accessibility code does.  In this instance, we need to be able to selectively tell Gail to not load.
Comment 1 Brad Taylor 2008-12-19 17:41:16 UTC
Created attachment 125013 [details] [review]
Patch against gtk 2.14.4
Comment 2 Willie Walker 2009-01-06 20:14:22 UTC
Li - what do you think?
Comment 3 Li Yuan 2009-01-07 02:26:02 UTC
The way Firefox does is set NO_AT_BRIDGE at Firefox startup, means only load GAIL. And load atk-bridge manually during Firefox accessibility initialization. This is because Firefox still needs GAIL to make file chooser accessible.

If Mono doesn't need GAIL at all, I think we need such patch.
Comment 4 Li Yuan 2009-01-07 02:59:07 UTC
Note this ENV is kind of dangerous, because with NO_GAIL=1, every GNOME applications will crash at startup.

Also we need to make sure Mono accessibility library is loaded before atk-bridge.
Comment 5 Brad Taylor 2009-01-07 14:47:00 UTC
Thanks for the review Li.  We've implemented this hack similar to the way that we've implemented the GTK_MODULES "fix" in the past.  We set it only for our particular application in addition to NO_AT_BRIDGE=1, and we unset NO_AT_BRIDGE when we load the bridge ourselves manually.

Since you marked it REVIEWED, I hope it's not presumptuous for me to commit the change.

Committed as r22072.
Comment 6 Matthias Clasen 2009-01-07 14:57:15 UTC
One thing to keep in mind with these env-based hacks is that you have to take care to not let them leak into the environment of spawned child processes, or else you break a11y e.g. for viewers launched from your browser.
Comment 7 Brad Taylor 2009-01-07 15:03:20 UTC
I absolutely agree, Matthias.  We'll be careful with the loaded shotgun.  Promise. :)
Comment 8 Matthias Clasen 2009-01-07 16:22:31 UTC
One way to make this less dangerous might be to do something like

NO_GAIL=firefox:openoffice:mono

and then compare to the binary name. That way firefox could set 
NO_GAIL=firefox and not worry about e.g. a spawned gedit picking it up.

Would be a bit more work, of course, and not entirely foolproof either.
Comment 9 Brad Taylor 2009-01-07 16:30:04 UTC
Hmm, I have a feeling this would cause more problems than it would solve.  OpenOffice has quite a few binaries:

brad@blackbird:~$ ls /usr/bin/oo*
/usr/bin/oobase    /usr/bin/ooffice         /usr/bin/ootool
/usr/bin/oocalc    /usr/bin/oofromtemplate  /usr/bin/ooweb
/usr/bin/ooconfig  /usr/bin/ooimpress       /usr/bin/oowriter
/usr/bin/oodraw    /usr/bin/oomath

and only Mono applications that use System.Windows.Forms need to have GAIL disabled.  Apps like Banshee still need it.
Comment 10 Matthias Clasen 2009-01-07 16:31:50 UTC
hmm, tricky
Comment 11 Li Yuan 2009-01-08 02:24:08 UTC
(In reply to comment #6)
> One thing to keep in mind with these env-based hacks is that you have to take
> care to not let them leak into the environment of spawned child processes, or
> else you break a11y e.g. for viewers launched from your browser.
> 

Yes. FF will unset the ENV after they load atk-bridge. Would Mono do similar thing? (Unset NO_GAIL after atk-bridge is loaded)
Comment 12 Andrés G. Aragoneses (IRC: knocte) 2009-01-08 03:06:39 UTC
(In reply to comment #11)
> Yes. FF will unset the ENV after they load atk-bridge. Would Mono do similar
> thing? (Unset NO_GAIL after atk-bridge is loaded)

We could do it, but seriously it's not an issue for us. When we say Mono here we indeed should say MonoWinforms, which is a different toolkit than gtk+. But one depends on the other because of an unfortunate issue, though this may change in the future.
Comment 13 Li Yuan 2009-01-08 03:23:59 UTC
Is it possible that Mono launch a Gtk+ application or Firefox or OpenOffice?


(In reply to comment #12)
> (In reply to comment #11)
> > Yes. FF will unset the ENV after they load atk-bridge. Would Mono do similar
> > thing? (Unset NO_GAIL after atk-bridge is loaded)
> 
> We could do it, but seriously it's not an issue for us. When we say Mono here
> we indeed should say MonoWinforms, which is a different toolkit than gtk+. But
> one depends on the other because of an unfortunate issue, though this may
> change in the future.
> 

Comment 14 Andrés G. Aragoneses (IRC: knocte) 2009-01-08 04:45:09 UTC
(In reply to comment #13)
> Is it possible that Mono launch a Gtk+ application or Firefox or OpenOffice?

Sure, but in another process. Would that inherit the env var value? We'll test, thanks for the hint.
Comment 15 Matthias Clasen 2009-01-08 05:20:27 UTC
(In reply to comment #14)
> . Would that inherit the env var value? 

Lots of things do. E.g. check out the docs for the envp parameter of g_spawn_async:

envp : child's environment, or NULL to inherit parent's
Comment 16 Brad Taylor 2009-01-08 14:53:10 UTC
There's been a bit of confusion between Andres and I, but we're unsetting the environment variables as soon as we can during our initialization sequence to prevent this.  Not to worry.