--- a/jni/src/AtkWrapper.c
+++ b/jni/src/AtkWrapper.c
@@ -258,6 +258,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                             jobject jAccContext)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+   if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(focus_notify_handler, para);
 }
@@ -335,6 +340,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
 {
 
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  } 
   CallbackPara *para = alloc_callback_para(global_ac);
   para->is_toplevel = (jIsToplevel == JNI_TRUE) ? TRUE : FALSE;
   gdk_threads_add_idle(window_open_handler, para);
@@ -412,6 +422,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                             jboolean jIsToplevel)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   para->is_toplevel = (jIsToplevel == JNI_TRUE) ? TRUE : FALSE;
   gdk_threads_add_idle(window_close_handler, para);
@@ -462,6 +477,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                                jobject jAccContext)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(window_minimize_handler, para);
 }
@@ -511,6 +531,11 @@ JNIEXPORT void JNICALL Java_org_GNOME_Ac
                                                                               jobject jAccContext)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac );
   gdk_threads_add_idle(window_maximize_handler, para);
 }
@@ -561,6 +586,11 @@ JNIEXPORT void JNICALL Java_org_GNOME_Ac
 {
 
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(window_restore_handler, para);
 }
@@ -609,6 +639,11 @@ JNIEXPORT void JNICALL Java_org_GNOME_Ac
                                                                               jobject jAccContext) {
 
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(window_activate_handler, para);
 }
@@ -659,6 +694,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
 {
 
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(window_deactivate_handler, para);
 }
@@ -710,6 +750,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
 {
 
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(window_state_change_handler, para);
 }
@@ -1044,6 +1089,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                            jobjectArray args)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   jobjectArray global_args = (jobjectArray)(*jniEnv)->NewGlobalRef(jniEnv, args);
   CallbackPara *para = alloc_callback_para(global_ac);
   para->signal_id = (gint)id;
@@ -1099,6 +1149,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                                   jboolean value)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+     if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   AtkStateType state_type = jaw_util_get_atk_state_type_from_java_state( jniEnv, state );
   para->atk_state = state_type;
@@ -1192,6 +1192,12 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                                jobject jAccContext)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (global_ac == NULL)
+  {
+    if (jaw_debug)
+      g_warning("Java_org_GNOME_Accessibility_AtkWrapper_componentAdded: global_ac == NULL");
+    return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(component_added_handler, para);
 }
@@ -1251,6 +1257,12 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                                  jobject jAccContext)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (global_ac == NULL)
+  {
+    if (jaw_debug)
+      g_warning("Java_org_GNOME_Accessibility_AtkWrapper_componentRemoved: global_ac == NULL");
+    return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(component_removed_handler, para);
 }
@@ -1295,6 +1350,11 @@ JNICALL Java_org_GNOME_Accessibility_Atk
                                                               jobject jAccContext)
 {
   jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+  if (!global_ac) {
+   if (jaw_debug)
+     g_warning("%s: global_ac == NULL", __func__);
+   return;
+  }
   CallbackPara *para = alloc_callback_para(global_ac);
   gdk_threads_add_idle(bounds_changed_handler, para);
 }
Index: java-atk-wrapper-0.33.3/jni/src/jawobject.c
===================================================================
--- java-atk-wrapper-0.33.3.orig/jni/src/jawobject.c
+++ java-atk-wrapper-0.33.3/jni/src/jawobject.c
@@ -296,6 +296,7 @@ jaw_object_get_name (AtkObject *atk_obj)
   {
     (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name);
     (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName);
+    atk_obj->name = NULL;
   }
 
   if (jstr != NULL)
