From 2a8e229238cb5add51fd557b1c1f6293f974fafe Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 6 Dec 2020 00:27:55 +0100 Subject: [PATCH] Avoid unnecessary wxDynamicCast in wxOSX code There is no need to check if the control is a wxComboBox if it turns out to already be a wxTextCtrl. No real changes, just a micro-optimization and simplification. --- src/osx/cocoa/window.mm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index e9e82814d0..a658637d42 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -2440,14 +2440,12 @@ void wxWidgetCocoaImpl::controlTextDidChange() if ( wxpeer ) { // since native rtti doesn't have to be enabled and wx' rtti is not aware of the mixin wxTextEntry, workaround is needed - wxTextCtrl *tc = wxDynamicCast( wxpeer , wxTextCtrl ); - wxComboBox *cb = wxDynamicCast( wxpeer , wxComboBox ); - if ( tc ) + if ( wxTextCtrl *tc = wxDynamicCast( wxpeer , wxTextCtrl ) ) { tc->MarkDirty(); tc->SendTextUpdatedEventIfAllowed(); } - else if ( cb ) + else if ( wxComboBox *cb = wxDynamicCast( wxpeer , wxComboBox ) ) cb->SendTextUpdatedEventIfAllowed(); else {