From 05862e608dac9cdc2d44a6b87fd1b35ff22d13f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 15 Aug 2015 18:54:02 +0200 Subject: [PATCH] Only set native label if nonempty in wxWindowMac::SetPeer() Some native controls don't take kindly to being set setStringValue: with a value invalid for the control (such as empty string for NSPathControl). Don't do this if the label is empty anyway to avoid problems with wxNativeWindow when the underlying native control is like that. (This is backport of db9baf9 from master) --- src/osx/window_osx.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 89fa0cc19c..6bfe8e2a17 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -356,7 +356,8 @@ void wxWindowMac::SetPeer(wxOSXWidgetImpl* peer) if ( !m_hasFont ) DoSetWindowVariant( m_windowVariant ); - GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; + if ( !m_label.empty() ) + GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; // for controls we want to use best size for wxDefaultSize params ) if ( !GetPeer()->IsUserPane() )