← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix focus bug and possible race-condition for path deletion

 

Hi,

a small follow-up patch for
https://bugs.launchpad.net/kicad/+bug/1788873 which fixes some remaining
issues

Regards, Thomas
From 7599429256c815142272db6bc1f0e8be64f174de Mon Sep 17 00:00:00 2001
From: Thomas Pointhuber <thomas.pointhuber@xxxxxx>
Date: Thu, 30 Aug 2018 14:21:01 +0200
Subject: [PATCH] Fix focus bug and possible race-condition for path deletion
 dialog

---
 common/dialogs/dialog_configure_paths.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/common/dialogs/dialog_configure_paths.cpp b/common/dialogs/dialog_configure_paths.cpp
index 6d8586a6a..5266a47a0 100644
--- a/common/dialogs/dialog_configure_paths.cpp
+++ b/common/dialogs/dialog_configure_paths.cpp
@@ -374,7 +374,7 @@ void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
 {
     int curRow = m_EnvVars->GetGridCursorRow();
 
-    if( curRow < 0 )
+    if( curRow < 0 || m_EnvVars->GetNumberRows() <= curRow )
         return;
     else if( IsEnvVarImmutable( m_EnvVars->GetCellValue( curRow, EV_NAME_COL ) ) )
     {
@@ -394,11 +394,8 @@ void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
 {
     int curRow = m_SearchPaths->GetGridCursorRow();
 
-    if( !m_SearchPaths->HasFocus() || curRow < 0 )
-    {
-        m_SearchPaths->SetFocus();
+    if( curRow < 0 || m_SearchPaths->GetNumberRows() <= curRow )
         return;
-    }
 
     m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
     m_SearchPaths->DeleteRows( curRow, 1 );
-- 
2.18.0

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups