From f97112a21e0aadbec49df603f554ebf0088e4207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 25 Oct 2014 12:49:11 +0000 Subject: [PATCH] Fix wxFontDialog exceptions on OS X Yosemite Opening the font dialog would result in an exception in RunMixedFontDialog: -[NSView resetFlags]: unrecognized selector sent to instance 0x6080001285c0 The code in question assumed that NSFontPanel's accessory view either didn't exist or was created by wx, and casted it to wxMacFontPanelAccView* without checking. But this assumption is no longer true on OS X 10.10, the view is apparently pre-set to some default NSView instance. Fix the code to check accessoryView's class before treating it as wxMacFontPanelAccView. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/fontdlgosx.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/osx/carbon/fontdlgosx.mm b/src/osx/carbon/fontdlgosx.mm index 19d64c972d..2d5b890c53 100644 --- a/src/osx/carbon/fontdlgosx.mm +++ b/src/osx/carbon/fontdlgosx.mm @@ -158,8 +158,8 @@ int RunMixedFontDialog(wxFontDialog* dialog) [fontPanel setFloatingPanel:NO] ; [[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:NO] ; - wxMacFontPanelAccView* accessoryView = (wxMacFontPanelAccView*) [fontPanel accessoryView] ; - if ( accessoryView == nil) + wxMacFontPanelAccView* accessoryView = nil; + if ( [fontPanel accessoryView] == nil || [[fontPanel accessoryView] class] != [wxMacFontPanelAccView class] ) { NSRect rectBox = NSMakeRect( 0 , 0 , 192 , 40 ); accessoryView = [[wxMacFontPanelAccView alloc] initWithFrame:rectBox]; @@ -168,6 +168,10 @@ int RunMixedFontDialog(wxFontDialog* dialog) [fontPanel setDefaultButtonCell:[[accessoryView okButton] cell]] ; } + else + { + accessoryView = (wxMacFontPanelAccView*)[fontPanel accessoryView]; + } [accessoryView resetFlags]; #if wxOSX_USE_COCOA