X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ca910e1a13bae98fc2c5ddbff35431c6fd66d6b7..6178debcd342963974dbdce6ac2ddb2fbe89e42a:/src/osx/carbon/button.cpp diff --git a/src/osx/carbon/button.cpp b/src/osx/carbon/button.cpp index 956ca32257..ea77565438 100644 --- a/src/osx/carbon/button.cpp +++ b/src/osx/carbon/button.cpp @@ -66,14 +66,21 @@ wxSize wxButton::DoGetBestSize() const OSStatus err = m_peer->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); verify_noerr( err ); - wxCFStringRef str( m_label, GetFont().GetEncoding() ); + // GetThemeTextDimensions will cache strings and the documentation + // says not to use the NoCopy string creation calls. + // This also means that we can't use CFSTR without + // -fno-constant-cfstrings if the library might be unloaded, + // as GetThemeTextDimensions may cache a pointer to our + // unloaded segment. + wxCFStringRef str( !m_label.empty() ? m_label : wxString(" "), + GetFont().GetEncoding() ); #if wxOSX_USE_ATSU_TEXT SInt16 baseline; if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont ) { err = GetThemeTextDimensions( - (!m_label.empty() ? (CFStringRef)str : CFSTR(" ")), + (CFStringRef)str, m_font.MacGetThemeFontID(), kThemeStateActive, false, &bounds, &baseline ); verify_noerr( err ); } @@ -148,6 +155,7 @@ wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer, break; case wxWINDOW_VARIANT_SMALL: maxHeight = 17; + break; case wxWINDOW_VARIANT_MINI: maxHeight = 15; }