GNOME Bugzilla – Bug 565110
Need a way to allow applications to choose not to load gail during startup
Last modified: 2009-01-08 14:53:10 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.
Created attachment 125013 [details] [review] Patch against gtk 2.14.4
Li - what do you think?
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.
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.
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.
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.
I absolutely agree, Matthias. We'll be careful with the loaded shotgun. Promise. :)
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.
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.
hmm, tricky
(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)
(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.
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. >
(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.
(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
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.