allow to add idle listener from any thread (http://crucible.labs.intellij.net/cru...
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Thu, 19 Nov 2015 13:28:00 +0000 (16:28 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Thu, 19 Nov 2015 13:28:23 +0000 (16:28 +0300)
platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java

index cd60e1fb562e56b20634ca1a3fd43da74b64f8c9..a1a27d86d6d6aed9655ad6de968795b6419310f1 100644 (file)
@@ -243,7 +243,12 @@ public class IdeEventQueue extends EventQueue {
       myIdleListeners.add(runnable);
       final MyFireIdleRequest request = new MyFireIdleRequest(runnable, timeout);
       myListener2Request.put(runnable, request);
-      myIdleRequestsAlarm.addRequest(request, timeout);
+      UIUtil.invokeLaterIfNeeded(new Runnable() {
+        @Override
+        public void run() {
+          myIdleRequestsAlarm.addRequest(request, timeout);
+        }
+      });
     }
   }