From e5bd3ecec66815f2b41b36f923e6f10f8fe7f53d Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Thu, 17 Mar 2022 00:04:55 +0700 Subject: [PATCH] Handle item adding to DVC to a non-container node --- src/generic/datavgen.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 0fc8e6514b..200788cd61 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3094,6 +3094,14 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData if ( !parentNode ) return false; + // If the parent has not children then just mask it as container and return. + // Nodes will be initialized in Expand(). + if ( !parentNode->HasChildren() ) + { + parentNode->SetHasChildren(true); + return true; + } + // If the parent has children but child nodes was not initialized then // the node is collapsed so just return as nodes will be initialized in // Expand().