From 2bab87b14032d49e180b83f3e93bbf15fd738584 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Sep 2021 18:28:38 +0200 Subject: [PATCH] Always initialize just added wxRibbonButtonBar field Initialize m_ribbonBar added in the previous commit to NULL before setting it to the correct value later, when wxRibbonButtonBar is fully created. See #19249. Co-Authored-By: Maarten Bent --- src/ribbon/buttonbar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 6d5800d730..f3780a7566 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -973,8 +973,10 @@ void wxRibbonButtonBar::OnSize(wxSizeEvent& evt) void wxRibbonButtonBar::CommonInit(long WXUNUSED(style)) { - if ( m_parent ) - m_ribbonBar = GetAncestorRibbonBar(); + // This can initialize it to NULL when we're called from the default ctor, + // but will set it to the correct value when used from non-default ctor or + // Create() later. + m_ribbonBar = GetAncestorRibbonBar(); m_bitmap_size_large = wxSize(32, 32); m_bitmap_size_small = wxSize(16, 16);