← Back to team overview

kicad-developers team mailing list archive

[PATCH] fix "opening view menu changes canvas" bug

 

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.

aiju

---
 pcbnew/basepcbframe.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp
index 569c03f..a27d9f3 100644
--- a/pcbnew/basepcbframe.cpp
+++ b/pcbnew/basepcbframe.cpp
@@ -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 );
     }
 }
--
2.1.4


Follow ups