[clutter] [cally] Fix a crash on some a11y examples if there isn't accessibility support



commit 247c8d49ae9a75ec7ae279b0bf787a3eb6fe0a2f
Author: Alejandro Piñeiro <apinheiro igalia com>
Date:   Fri May 20 14:00:35 2011 +0200

    [cally] Fix a crash on some a11y examples if there isn't accessibility support
    
    Most of the accessibility tests can be executed without the
    accessibility support, although it is clear that they will
    not work properly (ie using accerciser).
    
    But in some specific cases (right now just the atk event test),
    the test will crash if no accessibility support is enabled
    
    Fixes http://bugzilla.clutter-project.org/show_bug.cgi?id=2447

 tests/accessibility/cally-atkevents-example.c |    7 ++++++-
 tests/accessibility/cally-examples-util.c     |   10 +++++++---
 tests/accessibility/cally-examples-util.h     |    2 +-
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/tests/accessibility/cally-atkevents-example.c b/tests/accessibility/cally-atkevents-example.c
index fabfc6f..85e1d61 100644
--- a/tests/accessibility/cally-atkevents-example.c
+++ b/tests/accessibility/cally-atkevents-example.c
@@ -144,7 +144,12 @@ main (int argc, char *argv[])
   if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
     return 1;
 
-  cally_util_a11y_init (&argc, &argv);
+  if (cally_util_a11y_init (&argc, &argv) == FALSE)
+    {
+      g_error ("This example requires the accessibility support, "
+               "especifically AtkUtil implementation loaded, "
+               "as it tries to register and remove event listeners");
+    }
 
   data1.value = 10;
   data2.value = 20;
diff --git a/tests/accessibility/cally-examples-util.c b/tests/accessibility/cally-examples-util.c
index 875d6fc..ea3e31a 100644
--- a/tests/accessibility/cally-examples-util.c
+++ b/tests/accessibility/cally-examples-util.c
@@ -115,18 +115,20 @@ _a11y_invoke_module (const gchar  *module_path,
  *
  * Basically it will load the cally module using gmodule functions.
  *
+ * Returns if it was able to init the a11y support or not.
  */
-void
+gboolean
 cally_util_a11y_init (int *argc, char ***argv)
 {
   gchar *bridge_dir = NULL;
   gchar *bridge_path = NULL;
+  gboolean result = FALSE;
 
   if (clutter_get_accessibility_enabled () == FALSE)
     {
       g_warning ("Accessibility: clutter has no accessibility enabled"
                  " skipping the atk-bridge load");
-      return;
+      return FALSE;
     }
 
   bridge_dir = _a11y_check_custom_bridge (argc, argv);
@@ -135,8 +137,10 @@ cally_util_a11y_init (int *argc, char ***argv)
 
   bridge_path = g_module_build_path (bridge_dir, "libatk-bridge");
 
-  _a11y_invoke_module (bridge_path, TRUE);
+  result = _a11y_invoke_module (bridge_path, TRUE);
 
   g_free (bridge_dir);
   g_free (bridge_path);
+
+  return result;
 }
diff --git a/tests/accessibility/cally-examples-util.h b/tests/accessibility/cally-examples-util.h
index 0245f31..dab5926 100644
--- a/tests/accessibility/cally-examples-util.h
+++ b/tests/accessibility/cally-examples-util.h
@@ -20,5 +20,5 @@
  * Boston, MA 02111-1307, USA.
  */
 
-void
+gboolean
 cally_util_a11y_init (int *argc, char ***argv);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]