From cee3188c1abaa5b222c57b87cc94064e56921db8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 29 Feb 2016 18:47:30 +0100 Subject: [PATCH] Don't connect handler for wxEVT_TEXT_ENTER in wxComboCtrl unnecessarily Connecting to wxEVT_TEXT_ENTER is not necessary if wxTE_PROCESS_ENTER style is not used was always useless and is actively harmful since the changes of 5591a2009394c9bae43bcd2fa08f2fb51391cbc1 as it results in an assert failure now. Just don't do it unless we really want, and will get, these events. --- src/common/combocmn.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 4ab94315ee..d451d68c47 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -1100,9 +1100,12 @@ wxComboCtrlBase::CreateTextCtrl(int style) m_text->Connect(id, wxEVT_TEXT, wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), NULL, this); - m_text->Connect(id, wxEVT_TEXT_ENTER, - wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), - NULL, this); + if ( style & wxTE_PROCESS_ENTER ) + { + m_text->Connect(id, wxEVT_TEXT_ENTER, + wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), + NULL, this); + } m_text->SetHint(m_hintText); }