mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
LeakHunter: take read action when evaluating toString, some PSI elements require that
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.concurrency.AtomicFieldUpdater;
|
||||
import com.intellij.util.containers.FList;
|
||||
@@ -156,6 +158,7 @@ public class DebugReflectionUtil {
|
||||
String result = "";
|
||||
while (backLink != null) {
|
||||
String valueStr;
|
||||
AccessToken token = ReadAction.start();
|
||||
try {
|
||||
valueStr = backLink.value instanceof FList
|
||||
? "FList (size="+((FList)backLink.value).size()+")" :
|
||||
@@ -166,6 +169,9 @@ public class DebugReflectionUtil {
|
||||
catch (Throwable e) {
|
||||
valueStr = "(" + e.getMessage() + " while computing .toString())";
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
}
|
||||
Field field = backLink.field;
|
||||
String fieldName = field == null ? "?" : field.getDeclaringClass().getName()+"."+field.getName();
|
||||
result += "via '" + fieldName + "'; Value: '" + valueStr + "' of " + backLink.value.getClass() + "\n";
|
||||
|
||||
Reference in New Issue
Block a user