From ecb7235d7627d276b65cfccbd87ff13965c0c28e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 30 Mar 2007 16:05:25 +0000 Subject: [PATCH] don't use m_stylePopup inside GetRichTextCtrl() before testing whether it's NULL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextstyles.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index 38e5553150..0b8782c756 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -1088,9 +1088,19 @@ bool wxRichTextStyleComboCtrl::Create(wxWindow* parent, wxWindowID id, const wxP void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event) { - if (GetRichTextCtrl() && !IsPopupShown() && m_stylePopup && wxWindow::FindFocus() != this) + event.Skip(); + + if ( !m_stylePopup ) + return; + + wxRichTextCtrl * const richtext = GetRichTextCtrl(); + if ( !richtext ) + return; + + if ( !IsPopupShown() && wxWindow::FindFocus() != this ) { - wxString styleName = wxRichTextStyleListBox::GetStyleToShowInIdleTime(GetRichTextCtrl(), m_stylePopup->GetStyleType()); + wxString styleName = + wxRichTextStyleListBox::GetStyleToShowInIdleTime(richtext, m_stylePopup->GetStyleType()); wxString currentValue = GetValue(); if (!styleName.IsEmpty()) @@ -1104,7 +1114,6 @@ void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event) else if (!currentValue.IsEmpty()) SetValue(wxEmptyString); } - event.Skip(); } #endif -- 2.45.2