From a54830897b7011ef41e6bdf5e42df45f2cd48114 Mon Sep 17 00:00:00 2001 From: Julius Schmidt Date: Fri, 10 Feb 2017 14:51:22 -0500 Subject: [PATCH] Fix intermittent canvas revert to default The attached patch fixes a minor bug where opening the 'View' menu will sometimes revert the canvas to the default canvas. The problem is that wxMenuItem::Check will cause a menu event when the status is changed even if the checkmark is being *unset*. The workaround is to only call Check with a true argument. This works because the menu items are radio buttons. --- pcbnew/basepcbframe.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 569c03f822..0636e6b048 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -1048,6 +1048,7 @@ void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent ) for( auto ii: menuList ) { wxMenuItem* item = menuBar->FindItem( ii.menuId ); - item->Check( ii.galType == canvasType ); + if( ii.galType == canvasType ) + item->Check( true ); } }