--- src/kernel/qwidget_x11.cpp
+++ src/kernel/qwidget_x11.cpp
@@ -2751,7 +2751,7 @@
 */
 void QWidget::createInputContext()
 {
-    if( !isInputMethodEnabled() )
+    if( !isInputMethodEnabled() || QApplication::closingDown() )
       return;
 
     QWidget *icWidget = icHolderWidget();
