[hyena] ListView: Do not enable a11y when it would cause freezes (bgo#696111)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] ListView: Do not enable a11y when it would cause freezes (bgo#696111)
- Date: Sun, 7 Apr 2013 10:26:03 +0000 (UTC)
commit fec01af8d9602fd72a59219cd7a55da435c1be97
Author: Andres G. Aragoneses <knocte gmail com>
Date: Tue Apr 2 12:30:09 2013 +0100
ListView: Do not enable a11y when it would cause freezes (bgo#696111)
Recent versions of glib or gobject (2.35.4 and above) don't allow
anymore to add GInterfaces after class initialization, which causes the
Mono binding to fail when implementing interfaces in managed land (filed
in https://bugzilla.xamarin.com/show_bug.cgi?id=11510).
We're affected by this particularly when implementing the AtkTable
interface for the accessibility support of the ListView custom widget.
The consequence would be that the class would not implement the
interface properly, which would cause lots of exceptions in
OnCreateAccessible signals, high CPU usage and make the app hang.
The workaround for now is create a dummy instance of ListViewAccessible
class, and not enable accessibility if any exception is caught at
creation time.
Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>
.../Hyena.Data.Gui/ListView/ListView_Accessible.cs | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
index 3cdabeb..7c50e56 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
@@ -157,8 +157,17 @@ namespace Hyena.Data.Gui
{
public static void Init ()
{
- new ListViewAccessibleFactory<T> ();
- Atk.Global.DefaultRegistry.SetFactoryType ((GLib.GType)typeof (ListView<T>), (GLib.GType)typeof
(ListViewAccessibleFactory<T>));
+ try {
+ // Test creating a dummy accessible, which may throw if gobject binding has issues.
+ // If it throws, a11y for ListView will not be enabled.
+ // (workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=11510)
+ new ListViewAccessible<T> (new ListView<T> ());
+
+ new ListViewAccessibleFactory<T> ();
+ Atk.Global.DefaultRegistry.SetFactoryType ((GLib.GType)typeof (ListView<T>),
(GLib.GType)typeof (ListViewAccessibleFactory<T>));
+ } catch (Exception ex) {
+ Log.Exception ("Initialization of accessibility support for ListView widgets failed", ex);
+ }
}
protected override Atk.Object OnCreateAccessible (GLib.Object obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]