diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2017-04-05 21:58:57 +0200 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2017-04-06 04:25:47 +0000 |
commit | 5e3cd098daf7d4537c4826f45fe118e69f9a96d4 (patch) | |
tree | f8db00ff138f33478fd20ef685ef038d8c40b019 /vcl | |
parent | 4c0979d4a19626602f08bd02627f7c367b47e42f (diff) |
Fix crash while running the Notebookbar mode
Change-Id: Ifc9b900e49968c46768af3b9ee18bbb834f60557
Reviewed-on: https://gerrit.libreoffice.org/36165
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <eszkadev@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 37 |
1 files changed, 20 insertions, 17 deletions
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; + } } } |