From 020021e7f21a2e2a2ca32e35d08d18ebadd4a9f2 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Mon, 23 Dec 2024 20:50:23 +0300 Subject: [PATCH] Fix assert in hotkey list when double-clicking on a section header. Assert message: Assertion failed at C:\jenkins\workspace\build-windows-kicad-msvc-8.0-stable\.build\kicad\common\widgets\widget_hotkey_list.cpp:309 in WIDGET_HOTKEY_LIST::getExpectedHkClientData: hkdata != nullptr - No hotkey data found for list item Fixes KICAD-7NV (cherry picked from commit 9b40e6b2e304c0c54e9bc7d070d42bc1f60d48d0) --- common/widgets/widget_hotkey_list.cpp | 16 ++-------------- include/widgets/widget_hotkey_list.h | 6 ------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/common/widgets/widget_hotkey_list.cpp b/common/widgets/widget_hotkey_list.cpp index 2a59cbb83b..ffb31d40c8 100644 --- a/common/widgets/widget_hotkey_list.cpp +++ b/common/widgets/widget_hotkey_list.cpp @@ -300,18 +300,6 @@ WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getHKClientData( wxTreeListItem a } -WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getExpectedHkClientData( wxTreeListItem aItem ) -{ - const auto hkdata = getHKClientData( aItem ); - - // This probably means a hotkey-only action is being attempted on - // a row that is not a hotkey (like a section heading) - wxASSERT_MSG( hkdata != nullptr, "No hotkey data found for list item" ); - - return hkdata; -} - - void WIDGET_HOTKEY_LIST::updateFromClientData() { for( wxTreeListItem i = GetFirstItem(); i.IsOk(); i = GetNextItem( i ) ) @@ -369,7 +357,7 @@ void WIDGET_HOTKEY_LIST::changeHotkey( HOTKEY& aHotkey, long aKey, bool alternat void WIDGET_HOTKEY_LIST::editItem( wxTreeListItem aItem, int aEditId ) { - WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem ); + WIDGET_HOTKEY_CLIENT_DATA* hkdata = getHKClientData( aItem ); if( !hkdata ) return; @@ -403,7 +391,7 @@ void WIDGET_HOTKEY_LIST::editItem( wxTreeListItem aItem, int aEditId ) void WIDGET_HOTKEY_LIST::resetItem( wxTreeListItem aItem, int aResetId ) { - WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem ); + WIDGET_HOTKEY_CLIENT_DATA* hkdata = getHKClientData( aItem ); if( !hkdata ) return; diff --git a/include/widgets/widget_hotkey_list.h b/include/widgets/widget_hotkey_list.h index cb6a8a9efd..97c60cd784 100644 --- a/include/widgets/widget_hotkey_list.h +++ b/include/widgets/widget_hotkey_list.h @@ -142,12 +142,6 @@ private: */ WIDGET_HOTKEY_CLIENT_DATA* getHKClientData( wxTreeListItem aItem ); - /** - * Get the WIDGET_HOTKEY_CLIENT_DATA form an item and assert if it isn't found. This is for - * use when the data not being present indicates an error. - */ - WIDGET_HOTKEY_CLIENT_DATA* getExpectedHkClientData( wxTreeListItem aItem ); - /** * Method updateFromClientData * Refresh the visible text on the widget from the rows' client data objects.