Repository: haxefoundation/intellij-haxe
Issue: Stack frame does not include fields from "this" when debugging.

When debugging, there is a race condition (particularly with IDEA 14, which introduces "auto-expanding") where the variable lists are calculated and drawn before the data is available from the debugger.  This occurs more frequently with large projects.  The "this" pointer is particularly vulnerable to the error.

IDEA 14, 14.1
Plugin versions 0.9.3, 0.9.4..
JDK 1.6
OS: Linux

TIR: STB-10938


Changed files:
src/14.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java, src/14/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java, src/13.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java

diff --git a/src/13.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java b/src/13.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
index 39b05df3..b496b696 100644
--- a/src/13.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
+++ b/src/13.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
@@ -63,6 +63,7 @@ import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
 import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
 import com.intellij.xdebugger.frame.*;
 import com.intellij.xdebugger.impl.XSourcePositionImpl;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
 import haxe.root.JavaProtocol;
 import org.jetbrains.annotations.NotNull;
 
@@ -1113,8 +1114,17 @@ public class HaxeDebugRunner extends DefaultProgramRunner
                                      mIcon = AllIcons.General.Error;
                                      mValue = mType = "<Unavailable>";
                                  }
-                                 
-                                 Value.this.computePresentation(node, place);
+
+                               // If fromStructuredValue contained a list, we need to add all items to the node.
+                               if (null != mChildren) {
+                                 XValueChildrenList childrenList = new XValueChildrenList();
+                                 for (Value v : mChildren) {
+                                   childrenList.add(v.mName, v);
+                                 }
+                                 ((XValueNodeImpl)node).addChildren(childrenList, false);
+                               }
+
+                               Value.this.computePresentation(node, place);
                              }
                          });
                 }
diff --git a/src/14.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java b/src/14.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
index 1c4dabbd..5d0075bf 100644
--- a/src/14.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
+++ b/src/14.1/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
@@ -63,6 +63,7 @@ import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
 import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
 import com.intellij.xdebugger.frame.*;
 import com.intellij.xdebugger.impl.XSourcePositionImpl;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
 import haxe.root.JavaProtocol;
 import org.jetbrains.annotations.NotNull;
 
@@ -1014,6 +1015,15 @@ public class HaxeDebugRunner extends DefaultProgramRunner {
                    mValue = mType = "<Unavailable>";
                  }
 
+                 // If fromStructuredValue contained a list, we need to add all items to the node.
+                 if (null != mChildren) {
+                   XValueChildrenList childrenList = new XValueChildrenList();
+                   for (Value v : mChildren) {
+                     childrenList.add(v.mName, v);
+                   }
+                   ((XValueNodeImpl)node).addChildren(childrenList, false);
+                 }
+
                  Value.this.computePresentation(node, place);
                }
              });
diff --git a/src/14/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java b/src/14/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
index f687a877..418817dc 100644
--- a/src/14/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
+++ b/src/14/com/intellij/plugins/haxe/runner/debugger/HaxeDebugRunner.java
@@ -63,6 +63,7 @@ import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
 import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
 import com.intellij.xdebugger.frame.*;
 import com.intellij.xdebugger.impl.XSourcePositionImpl;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
 import haxe.root.JavaProtocol;
 import org.jetbrains.annotations.NotNull;
 
@@ -1014,6 +1015,15 @@ public class HaxeDebugRunner extends DefaultProgramRunner {
                    mValue = mType = "<Unavailable>";
                  }
 
+                 // If fromStructuredValue contained a list, we need to add all items to the node.
+                 if (null != mChildren) {
+                   XValueChildrenList childrenList = new XValueChildrenList();
+                   for (Value v : mChildren) {
+                     childrenList.add(v.mName, v);
+                   }
+                   ((XValueNodeImpl)node).addChildren(childrenList, false);
+                 }
+
                  Value.this.computePresentation(node, place);
                }
              });