From 6be1e373d5e9a35abffab37a82b15a1b10de20e0 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 30 Nov 2012 20:20:56 -0500 Subject: [PATCH] Fix typecasting in address->compound node case. - In the special case of an address node with a hidden child, we must send notifications for removal of the hidden compound's children rather than for the hidden node itself. Otherwise the base TreeTable's state gets out of sync, leading to a crash when attempting to typecast such a node. --- .../user_interface/gui/team_window/VariablesView.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 744a2d1e86..bba9d0566f 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -1030,6 +1030,17 @@ VariablesView::VariableTableModel::ValueNodeChildrenDeleted(ValueNode* node) if (modelNode == NULL) return; + // in the case of an address node with a hidden child, + // we want to send removal notifications for the children + // instead. + if (modelNode->CountChildren() == 1 + && modelNode->ChildAt(0)->IsHidden()) { + ModelNode* tempNode = modelNode->ChildAt(0); + modelNode->RemoveChild(tempNode); + modelNode = tempNode; + fNodeTable.Remove(tempNode); + } + for (int32 i = 0; i < modelNode->CountChildren(); i++) { BReference childNode = modelNode->ChildAt(i); TreeTablePath treePath;