From 9b5f5805b48f29ad4dbeebd73a5ef887c34c91f7 Mon Sep 17 00:00:00 2001 From: vitaliy Date: Sun, 23 Feb 2025 09:47:07 +0200 Subject: [PATCH 1/2] 2487: Add dispatch thread check before applying fix Ensures that `applyFix` is only called on the dispatch thread to prevent potential threading issues. This change improves safety and aligns with IntelliJ threading requirements. --- .../inspections/php/fix/PhpModuleNameQuickFix.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/magento/idea/magento2plugin/inspections/php/fix/PhpModuleNameQuickFix.java b/src/main/java/com/magento/idea/magento2plugin/inspections/php/fix/PhpModuleNameQuickFix.java index 02b9b4ba5..db17694d6 100644 --- a/src/main/java/com/magento/idea/magento2plugin/inspections/php/fix/PhpModuleNameQuickFix.java +++ b/src/main/java/com/magento/idea/magento2plugin/inspections/php/fix/PhpModuleNameQuickFix.java @@ -7,6 +7,7 @@ import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.project.Project; import com.jetbrains.php.lang.psi.elements.StringLiteralExpression; @@ -38,7 +39,9 @@ public void applyFix( ) { final StringLiteralExpression expression = (StringLiteralExpression) descriptor.getPsiElement(); - applyFix(expression); + if (ApplicationManager.getApplication().isDispatchThread()) { + applyFix(expression); + } } private void applyFix(final StringLiteralExpression expression) { From db9a41efd342bc9226985b3944f8b40c99c33fde Mon Sep 17 00:00:00 2001 From: vitaliy Date: Sun, 23 Feb 2025 09:49:31 +0200 Subject: [PATCH 2/2] 2487: Add changelog entry for threading fix Include details of the threading issue addressed to improve clarity in the changelog. This ensures developers are aware of the fix and its context. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd0d34a67..94452dddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0). - Compatibility with PhpStorm/IntelliJ 2025.* [#2495](https://github.com/magento/magento2-phpstorm-plugin/pull/2495) - "Copy Path/Reference" does not show the preview value [#2497](https://github.com/magento/magento2-phpstorm-plugin/pull/2497) +- Must not start write action from within read action in the other thread [#2498](https://github.com/magento/magento2-phpstorm-plugin/pull/2498) ## 2025.0.0