From 9690c38b83fd6bfc8481dfbb72980b1373fec8f0 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 2 Mar 2018 03:39:25 +0800 Subject: [PATCH] fix crash that occurs when place::modify a field which isn't leftmost one --- source/gui/place.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/gui/place.cpp b/source/gui/place.cpp index f243fcf0..7b79e910 100644 --- a/source/gui/place.cpp +++ b/source/gui/place.cpp @@ -1,7 +1,7 @@ /* * An Implementation of Place for Layout * 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 @@ -3184,6 +3184,22 @@ namespace nana modified_ptr->div_owner = div_owner; modified_ptr->div_next = div_next; + + if (div_owner) + { + implement::division * pv_div = nullptr; + //Updates the div_next of the div at front of modified one. + for (auto & div : div_owner->children) + { + if (div.get() == modified_ptr) + { + if (pv_div) + pv_div->div_next = modified_ptr; + break; + } + pv_div = div.get(); + } + } } catch (...) {