From 4d4adf07538f87536cf3196cd65b859efc05b079 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 20 Jul 2019 17:31:16 -0600 Subject: [PATCH] A possible hack to work around the apple runModal bug. Fixes: lp:1837225 * https://bugs.launchpad.net/kicad/+bug/1837225 --- eeschema/tools/sch_edit_tool.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 95c0d15d79..9b94edcd37 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1022,13 +1022,22 @@ void SCH_EDIT_TOOL::editComponentFieldText( SCH_FIELD* aField ) if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved m_frame->SaveCopyInUndoList( component, UR_CHANGED ); - wxString title; - title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) ); + wxString title = wxString::Format( _( "Edit %s Field" ), aField->GetName() ); DIALOG_SCH_EDIT_ONE_FIELD dlg( m_frame, title, aField ); - // The dialog may invoke a kiway player for footprint fields - // so we must use a quasimodal +#ifdef __WXMAC__ + // This dialog, like no other that we currently know of, sometimes provokes Apple's + // "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair" + // bug, and these seem to prevent it. Don't ask. + // Note: this doesn't seem to have anything to do with it being a quasi-modal: the + // bug happens even if it's changed to a normal modal. + wxSafeYield(); // Apple: strike 1 + wxSafeYield(); // Apple: strike 2 + wxSafeYield(); // Apple: strike 3; you're out +#endif + + // The footprint field dialog can invoke a KIWAY_PLAYER so we must use a quasi-modal if( dlg.ShowQuasiModal() != wxID_OK ) return;