fix crash that occurs when place::modify a field which isn't leftmost one

This commit is contained in:
Jinhao 2018-03-02 03:39:25 +08:00
parent 56143087c3
commit 9690c38b83

View File

@ -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 (...)
{