vcl/source/control/tabctrl.cxx | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
New commits: commit 5e3cd098daf7d4537c4826f45fe118e69f9a96d4 Author: Szymon KÅos <eszka...@gmail.com> Date: Wed Apr 5 21:58:57 2017 +0200 Fix crash while running the Notebookbar mode Change-Id: Ifc9b900e49968c46768af3b9ee18bbb834f60557 Reviewed-on: https://gerrit.libreoffice.org/36165 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Szymon KÅos <eszka...@gmail.com> diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 2df0fbfd5028..6e21f9511f78 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2225,27 +2225,30 @@ void NotebookbarTabControlBase::SetContext( vcl::EnumContext::Context eContext ) { bool bHandled = false; - for (int nChild = 0; nChild < GetChildCount(); ++nChild) + for (int nChild = 0; nChild < GetPageCount(); ++nChild) { - TabPage* pPage = static_cast<TabPage*>(GetChild(nChild)); - sal_uInt16 nPageId = TabControl::GetPageId(*pPage); + sal_uInt16 nPageId = TabControl::GetPageId(nChild); + TabPage* pPage = GetTabPage(nPageId); - if (pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Any)) - EnablePage(nPageId); - else - EnablePage(nPageId, false); - - if (!bHandled && bLastContextWasSupported - && pPage->HasContext(vcl::EnumContext::Context::Default)) + if (pPage) { - SetCurPageId(nPageId); - } + if (pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Any)) + EnablePage(nPageId); + else + EnablePage(nPageId, false); - if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Any) - { - SetCurPageId(nPageId); - bHandled = true; - bLastContextWasSupported = true; + if (!bHandled && bLastContextWasSupported + && pPage->HasContext(vcl::EnumContext::Context::Default)) + { + SetCurPageId(nPageId); + } + + if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Any) + { + SetCurPageId(nPageId); + bHandled = true; + bLastContextWasSupported = true; + } } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits