[Libreoffice-commits] core.git: vcl/source
Szymon Kłos
eszkadev at gmail.com
Thu Apr 6 04:26:12 UTC 2017
vcl/source/control/tabctrl.cxx | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
New commits:
commit 5e3cd098daf7d4537c4826f45fe118e69f9a96d4
Author: Szymon Kłos <eszkadev at 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 <ci at libreoffice.org>
Reviewed-by: Szymon Kłos <eszkadev at 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;
+ }
}
}
More information about the Libreoffice-commits
mailing list