Merge "Fix a native crash in input dispatcher when windows are removed." into gingerbread
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp
index 4112328..92daee1 100644
--- a/libs/ui/InputDispatcher.cpp
+++ b/libs/ui/InputDispatcher.cpp
@@ -2536,9 +2536,9 @@
 #if DEBUG_FOCUS
                 LOGD("Touched window was removed: %s", touchedWindow.channel->getName().string());
 #endif
-                mTouchState.windows.removeAt(i);
                 synthesizeCancelationEventsForInputChannelLocked(touchedWindow.channel,
                         InputState::CANCEL_POINTER_EVENTS, "touched window was removed");
+                mTouchState.windows.removeAt(i);
             }
         }