From e9ffb3f662b93cb0789e9192e62a2280ba3f8f82 Mon Sep 17 00:00:00 2001 From: zhivko Date: Tue, 15 Mar 2016 20:22:30 +0100 Subject: [PATCH] Fix crash when updating art provider of a ribbon with scroll buttons Don't leave the scroll buttons with the old, possibly soon to be deleted, art provider pointer. See #17441. (cherry picked from commit 6e5a2b630a937517258dbd6df0d9bc842c2e46a5) --- src/ribbon/page.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ribbon/page.cpp b/src/ribbon/page.cpp index 1fd662165e..efc4e9936f 100644 --- a/src/ribbon/page.cpp +++ b/src/ribbon/page.cpp @@ -224,6 +224,14 @@ void wxRibbonPage::SetArtProvider(wxRibbonArtProvider* art) ribbon_child->SetArtProvider(art); } } + + // The scroll buttons are children of the parent ribbon control, not the + // page, so they're not taken into account by the loop above, but they + // still use the same art provider, so we need to update them too. + if ( m_scroll_left_btn ) + m_scroll_left_btn->SetArtProvider(art); + if ( m_scroll_right_btn ) + m_scroll_right_btn->SetArtProvider(art); } void wxRibbonPage::AdjustRectToIncludeScrollButtons(wxRect* rect) const