From f0d5e9541254f5e0ae81dc55fb667d101cf55a6a Mon Sep 17 00:00:00 2001 From: John Roberts Date: Wed, 24 Jan 2018 16:40:26 +0100 Subject: [PATCH] Fix crash when clearing read-only wxOwnerDrawnComboBox Check that we have an associated text entry before clearing it. Fixes a crash introduced by 72fe57ec182ba0bc9a51ad27adc883a945d39b81 without reverting it as it still seems reasonable to use Clear() here. Closes #18013. --- src/generic/odcombo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index 89ec54016b..d77833bb16 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -991,7 +991,9 @@ void wxOwnerDrawnComboBox::DoClear() GetVListBoxComboPopup()->Clear(); - wxTextEntry::Clear(); + // There is no text entry when using wxCB_READONLY style, so test for it. + if ( GetTextCtrl() ) + wxTextEntry::Clear(); } void wxOwnerDrawnComboBox::Clear()