Thank you both for the comments. I have made some changes
void InfoPane::ReorderTabs(CompareFunction cmp_f)
{
if (m_Pages.IsEmpty())
return;
m_Pages.Sort(cmp_f);
cbAuiNotebook::Hide();
size_t index = 0;
for (size_t i = 0 ; i < m_Pages.GetCount(); ++i)
{
const Page* page = m_Pages.Item(i);
int pageIndex = GetPageIndex(page->window); // wx3.3.0 has GetPagePosition()
if (page->indexInNB < 0)
{
if (pageIndex != wxNOT_FOUND)
RemovePage(pageIndex);
if (page->window)
page->window->Hide();
}
else
{
if (pageIndex == wxNOT_FOUND)
pageIndex = AddPagePrivate(page->window, page->title, page->icon);
if (index++ != static_cast <size_t> (pageIndex))
if (index < GetPageCount())
MovePage(page->window, index);
}
}
cbAuiNotebook::Show();
}
that work with wxWidgets 3.3.1, but if you later start the "old" C::B (compiled with wx3.2.8 ) the layout in default.conf is corrupted.
I have tested with GetPagePosition() but there is no difference.
I think the problem is MovePage() in wx3.2.8 is tolerant to invalid indexes, and the behaviour with these invalid indexes is needed in the algorithm.
EDIT: IIRC saving AUI layouts has also changed, I hope this is not related.