From 7919f276af16d65ba39328cf6fe054cd00bc2448 Mon Sep 17 00:00:00 2001 From: Nikolay Rykunov Date: Mon, 15 Dec 2025 16:59:02 +0100 Subject: [PATCH] [platform] IJPL-223937: Propagate context to read action checks for rescheduling Since lambda passed to `backendExecutor.execute(r)` is ContextAwareRunnable we should handle context ourselves GitOrigin-RevId: 450d1f069520b870384956785f3f67af9b1019bd --- .../application/impl/NonBlockingReadActionImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/NonBlockingReadActionImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/NonBlockingReadActionImpl.java index 905b28cdb579..c0a956403b67 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/NonBlockingReadActionImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/NonBlockingReadActionImpl.java @@ -561,7 +561,18 @@ public final class NonBlockingReadActionImpl implements NonBlockingReadAction } finally { if (builder.myCoalesceEquality != null) { - release(); + if (AppExecutorUtil.propagateContext()) { + // `release` should be called under [myChildContext] as well + // since it executes some code to check when to call computation, and this code may rely on the context + // e.g. in analyzer: Application and Project are stored in context and `release` uses Application + ThreadContext.installThreadContext(myChildContext.getContext(), true, () -> { + release(); + return Unit.INSTANCE; + }); + } + else { + release(); + } } } };