diff --git a/widget/src/os2/nsWindow.cpp b/widget/src/os2/nsWindow.cpp
--- a/widget/src/os2/nsWindow.cpp
+++ b/widget/src/os2/nsWindow.cpp
@@ -3071,7 +3071,7 @@
   } // if paint flashing
 #endif
 
-  if (mContext && (mEventCallback || mEventListener)) {
+  if (mContext && mThebesSurface && (mEventCallback || mEventListener)) {
     // Get rect to redraw and validate window
     RECTL rcl = { 0 };
 
@@ -3145,7 +3145,7 @@
     if (hpsDrag) {
       ReleaseIfDragHPS(hpsDrag);
     }
-  } // if (mContext && (mEventCallback || mEventListener))
+  } // if (mContext && mThebesSurface && (mEventCallback || mEventListener))
 
 #ifdef NS_DEBUG
   if (debug_WantPaintFlashing()) {
