diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
index b77fadc..520305a 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -659,9 +659,11 @@ void nsWindow::Destroy() {
   // We need to detach accessible object here because mContainer is a custom
   // widget and doesn't call gtk_widget_real_destroy() from destroy handler
   // as regular widgets.
+#ifdef ACCESSIBILITY
   if (AtkObject* ac = gtk_widget_get_accessible(GTK_WIDGET(mContainer))) {
     gtk_accessible_set_widget(GTK_ACCESSIBLE(ac), nullptr);
   }
+#endif
 
   gtk_widget_destroy(mShell);
   mShell = nullptr;
