From e211757af46da077a2bec48f475d74cdbc22e3ee Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 12 May 2015 17:08:11 +0200 Subject: [PATCH] Don't use wxToolBarToolBase::SetNormalBitmap() in wxToolbook. This doesn't work, use wxToolBar::SetToolNormalBitmap() which does. As a side effect, don't silently ignore invalid page indices in wxToolbook::SetPageImage() any more, they should result in an assert, which is now going to happen inside wxToolBar::SetToolNormalBitmap() if this method is called with an invalid index. See #16985. --- src/generic/toolbkg.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/generic/toolbkg.cpp b/src/generic/toolbkg.cpp index 6c6b9d2d4f..40ea3a99c2 100644 --- a/src/generic/toolbkg.cpp +++ b/src/generic/toolbkg.cpp @@ -167,16 +167,9 @@ bool wxToolbook::SetPageImage(size_t n, int imageId) if (!GetImageList()) return false; - wxToolBarToolBase* tool = GetToolBar()->FindById(n + 1); - if (tool) - { - // Find the image list index for this tool - wxBitmap bitmap = GetImageList()->GetBitmap(imageId); - tool->SetNormalBitmap(bitmap); - return true; - } - else - return false; + GetToolBar()->SetToolNormalBitmap(n + 1, GetImageList()->GetBitmap(imageId)); + + return true; } // ----------------------------------------------------------------------------