From 335305c97c369ca3dd1b6cac87f760ecc6fcc7f0 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sun, 1 Apr 2018 00:11:19 +0800 Subject: [PATCH] fix bug that treebox::item_proxy::size returns the depth of the node --- source/gui/widgets/treebox.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index 88468861..ac4c2799 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -1,7 +1,7 @@ /* * A Treebox Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -958,10 +958,14 @@ namespace nana return *this; } + std::size_t item_proxy::size() const { std::size_t n = 0; - for(auto child = node_->child; child; child = child->child) + + //Fixed by ErrorFlynn + //this method incorrectly returned the number of levels beneath the nodes using child = child->child + for(auto child = node_->child; child; child = child->next) ++n; return n;