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/branches/WX_3_0_BRANCH@78071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -161,8 +161,8 @@ int RunMixedFontDialog(wxFontDialog* dialog)
|
|||||||
[fontPanel setFloatingPanel:NO] ;
|
[fontPanel setFloatingPanel:NO] ;
|
||||||
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:NO] ;
|
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:NO] ;
|
||||||
|
|
||||||
wxMacFontPanelAccView* accessoryView = (wxMacFontPanelAccView*) [fontPanel accessoryView] ;
|
wxMacFontPanelAccView* accessoryView = nil;
|
||||||
if ( accessoryView == nil)
|
if ( [fontPanel accessoryView] == nil || [[fontPanel accessoryView] class] != [wxMacFontPanelAccView class] )
|
||||||
{
|
{
|
||||||
NSRect rectBox = NSMakeRect( 0 , 0 , 192 , 40 );
|
NSRect rectBox = NSMakeRect( 0 , 0 , 192 , 40 );
|
||||||
accessoryView = [[wxMacFontPanelAccView alloc] initWithFrame:rectBox];
|
accessoryView = [[wxMacFontPanelAccView alloc] initWithFrame:rectBox];
|
||||||
@@ -171,6 +171,10 @@ int RunMixedFontDialog(wxFontDialog* dialog)
|
|||||||
|
|
||||||
[fontPanel setDefaultButtonCell:[[accessoryView okButton] cell]] ;
|
[fontPanel setDefaultButtonCell:[[accessoryView okButton] cell]] ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
accessoryView = (wxMacFontPanelAccView*)[fontPanel accessoryView];
|
||||||
|
}
|
||||||
|
|
||||||
[accessoryView resetFlags];
|
[accessoryView resetFlags];
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
|
Reference in New Issue
Block a user